Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Smarter image resize
-
I'm wondering if Pythonista could be used to solve a problem that thus far I've been unable to address with any of the image editing apps on the iTunes store.
I need to be able to create images of a particular size, from a variety of source pictures with differing dimensions and aspect ratios.
Tinkering with Image.resize, I can obviously convert any image to a specific size, but depending on the original dimensions/aspect ratio this will distort the result.
Ideally, I would like to be able to read in the image size, check how this compares against my desired final sizing, resize the image down so that the width is no less than 692px and height at least 484px, then crop from the middle of the product to produce the final shot.
I can't see any obvious way to do this using crop, or transform. Does anyone have any idea/suggestions on how to achieve the above?
-
I would assume this is feasible using PIL's crop, see http://stackoverflow.com/questions/9983263/crop-the-image-using-pil-in-python.
Otherwise, now that numpy is included in Pythonista, you could do the cropping using arrays, then convert back to an Image object.
-