[Pythonmac-SIG] PIL gui with Panther python?

David Eppstein eppstein at ics.uci.edu
Sun Jul 11 19:36:27 CEST 2004


On 7/11/04 7:20 PM +0200 Ronald Oussoren <ronaldoussoren at mac.com> wrote:
>> I guess I don't, but the code I was porting involved using PIL to
>> resize and display images.  Does Cocoa have routines for rotation,
>> antialiased downsizing, and saving back out to jpeg?  I didn't see
>> them in a quick scan of the Cocoa "Drawing and Images" doc but maybe I
>> was looking in the wrong place.
>
> I don't know about saving, but I have written a tool that rotates and
> resizes images. That tool uses NSAffineTransformations to do the job.

Looks like what I want is 
NSBitmapImageRep.representationUsingType_Properties(NSJPEGFileType,
{NSImageCompressionFactor:...}).writeToFile_atomically_(...)
which is a little clunkier than PIL's Image.save(...) but I guess not too 
horrible.

I suppose I should do some experimenting to find out how to use 
NSAffineTransformation to downsize and whether the results are properly 
antialiased...

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science



More information about the Pythonmac-SIG mailing list