Re: Flipping an NSImage (SOLVED)
Re: Flipping an NSImage (SOLVED)
- Subject: Re: Flipping an NSImage (SOLVED)
- From: Michael Becker <email@hidden>
- Date: Fri, 7 Oct 2005 02:44:15 +0200
Hi John,
Am 06.10.2005 um 22:47 schrieb John Pannell:
I have an app that gathers images from the web; the sizes/
resolutions/bitdepths are all over the place. I have found it
helpful to create the image via NSBitmapImageRep, like so...
Actually I did that, already. Here's my code:
NSBitmapImageRep *imageRep = [NSBitmapImageRep
imageRepWithContentsOfFile:path];
NSImage *image = [[NSImage alloc] initWithSize:[imageRep size]];
[image addRepresentation:imageRep];
That did not work. But luckily I only need JPEG support and in my
application I am using the EPEG library. With EPEG, I could always
determine the correct pixel size. So changing my code to this:
NSSize pixelSize = [self epegPixelSizeForPath:path];
NSBitmapImageRep *imageRep = [NSBitmapImageRep
imageRepWithContentsOfFile:path];
NSImage *image = [[NSImage alloc] initWithSize:pixelSize];
[image addRepresentation:imageRep];
solved all my issues, including the flipping thing. Maybe a negative
height would result in this strange flipping behavior as I
encountered it.
I haven't checked, but do you think there is a difference between
calling [NSImageRep +imageRepWithContentsOfFile:] and going the
detour via NSData as you suggested?
Regards,
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden