PMXBOT Log file Viewer

Help | Karma | Search:

#dcpython logs for Wednesday the 26th of December, 2012

(Back to #dcpython overview) (Back to channel listing) (Animate logs)
[21:40:18] <streety> aclark: I was considering writing a method to resize an image (almost certainly a bad idea) and took a look at PIL/Pillow. I was struggling to find the code that resized an image though. Any chance you could point it out?
[21:50:36] <aclark> streety: does this help? http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio
[21:55:21] <streety> I was more interested in what was going on under the hood. I'm fairly comfortable with PIL but there is a small spanner in the works. I have an image as a numpy array. In the past I have converted it to a PIL image but the co-ordinate layout for the image is different in PIL and numpy. I was wondering if instead of converting back and forth I could instead re-implement whatever PIL does working directly on the numpy array
[21:59:06] <aclark> streety: oh, no idea. I don't know PIL that well but you can look at the source of course: https://github.com/python-imaging/Pillow
[21:59:26] <aclark> streety: i've done very little "real" imaging work with PIL
[22:00:38] <aclark> streety: i'd ask on image-sig
[22:07:46] <streety> Yeah I looked at the code on github but couldn't find whatever code it is that handles the resizing. I suspect this is one of those times when the smartest move is not to dive too deep and go with the easy option even if it isn't the cleanest.
[22:22:47] <aclark> streety: looks like calls to imgin and imgout: https://github.com/python-imaging/Pillow/blob/master/libImaging/Geometry.c#L910
[22:36:25] <streety> that could be really useful, I think I've seen an affine transform function somewhere in the numpy/scipy code