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.