I was comparing a different fonts apparently, my bad.The paths are indeed going the right way.
Posts made by dyb
RE: BezierPath: Contours and Segments
Thanks for the explanation @frederik. It was just a little confusing seeing this output for the first time. It's also weird that the points are suggesting clockwise movement even though the path in the font is counterclockwise.
P.S. I already managed to manipulate the list to my needs.
BezierPath: Contours and Segments
I've been playing around with this lately and have a question.
Following the sample code from DrawBot website, if we take a look at the segments:
path = BezierPath() path.text("J", font="Helvetica", fontSize=200) for contour in path.contours: for segment in contour: print(segment)
Every iteration we get a list item with either 1 or 3 tuple items with x and y point coordinates:
[(85.64453125, 42.7734375)] [(85.64453125, 30.664001953125002), (83.8541845703125, 21.2565439453125), (80.2734375, 14.55078125)] [(73.632779296875, 2.3111367187500003), (61.002697265625, -3.80859375), (42.3828125, -3.80859375)] [(31.6405712890625, -3.80859375), (22.460975585937497, -0.8952114257812498), (14.84375, 4.931640625)] [(7.226524414062499, 10.75849267578125), (3.41796875, 21.126227539062498), (3.41796875, 36.03515625)] [(3.41796875, 46.2890625)] [(21.6796875, 46.2890625)] [(21.6796875, 36.03515625)] [(21.6796875, 28.2226171875), (23.42120654296875, 22.347024902343747), (26.904296875, 18.408203125)] [(30.38738720703125, 14.46938134765625), (35.8072548828125, 12.5), (43.1640625, 12.5)] [(53.5156767578125, 12.5), (60.286442382812496, 16.0481416015625), (63.4765625, 23.14453125)] [(65.429697265625, 27.5065322265625), (66.40625, 35.742126953125), (66.40625, 47.8515625)] [(66.40625, 143.45703125)] [(85.64453125, 143.45703125)]
I would expect to get lists of 2 (for straight segments) and 4 (for curves). This is what I get in the GlyphsApp at least.
Are these more like drawing instructions? So the first one would be
moveTo()then depending on what is in front of it would be either
curveTo()? But then if the last list is a single tuple you have go back to the first item with
lineTo()or just do
How to get image DPI?
I'm using ImageObject to load an image to drawBot, process it through some filters and then save it as a new image. Simple batch processing.
Everything goes well when the images i input are 72dpi.
If the input image is set to more than 72dpi then saved images is smaller (in absolute px value).
I noticed there's an option to specify imageResolution for the saveImage() function so i'm assuming that i would need to match the dpi of the input and output image to keep the right size.
But how can i get the input image dpi?
Generating A LOT of images. 1M+
I was asked to generate a lot of images.
Definitely more than 1M... I'd say around 33 554 432 specifically ^^'.
I'm running drawBot as a module that i set up in a virtualenv for this.
I'm pretty happy with the performance of my script. It generates around 100 images/second and if i calculate correctly it will finish in about 90 hours...
So i opened the activity monitor and noticed that Python is maxed out at 100% since it only uses one core (thread?). I'm not familiar with the topic... What would be the best way to utilise all CPU power? My CPU (i7-6820HQ) has 4 cores and each has 2 threads i guess? So that would be potentially 8x faster?
I can split the script in parts and run 4 scripts at once.
Can i use the same virtualenv Python installation in 4 terminal windows?
Or do i have to set up 4 virtualenvs?
Use another machine
I only have one.
I'm also concerned about the increasing number of memory used by Python. Right now it's at 100MB and it's increasing proportionally the more files i generate. 33M files would take around 30GB in this case.
What would be the best way to approach this?
RE: Possible solution to Just's puzzle?
An example with
radialGradient()building on @justvanrossum example.
size(1000, 1000) fill(0) dia = 864 offset = 120 rect(0, 0, width(), height()) d = 1200 blendMode("lighten") radialGradient((350-offset, 750+offset), (350-offset, 750+offset), [(1,), (0,)], startRadius=5, endRadius=0.7*dia) oval(350-.5*d, 750-.5*d, d, d) radialGradient((650-offset, 250+offset), (650-offset, 250+offset), [(1,), (0,)], startRadius=5, endRadius=0.35*dia) oval(650-.5*d, 250-.5*d, d, d)