• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Flipping an NSImage (SOLVED)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Flipping an NSImage (From: Michael Becker <email@hidden>)
 >Re: Flipping an NSImage (even more trouble with size) (From: Michael Becker <email@hidden>)
 >Re: Flipping an NSImage (even more trouble with size) (From: John Pannell <email@hidden>)

  • Prev by Date: Printing multiple pages using drawRect:
  • Next by Date: Re: Printing multiple pages using drawRect:
  • Previous by thread: Re: Flipping an NSImage (even more trouble with size)
  • Next by thread: CoreData - sqlite - statement is still active
  • Index(es):
    • Date
    • Thread