Displaying high PPI image at proper size
Displaying high PPI image at proper size
- Subject: Displaying high PPI image at proper size
- From: Loren Ryter <email@hidden>
- Date: Wed, 18 Jun 2008 06:49:30 -0400
- Thread-topic: Displaying high PPI image at proper size
Hello all.
I'm trying to make sure any image included in an RSS feed is displayed at
the proper size. I've found some images, such as netflix, store 300 dpi
images, which when displayed (in a Growl notification) appear at about 24%
of their "actual" size.
The example I'm working with is this:
http://cdn-0.nflximg.com/us/boxshots/small/70057002.jpg
The image displays correctly in Safari, in Preview, and in Path Finder. Only
in Growl does it seem to have problems (where it appears at about 6x9
pixels) -- but the fact that it opens at 24% in Graphic Converter and shows
300 ppi (with 64x90 pixels) indicates that its not entirely a Growl problem
-- the other apps are adjusting.
Since I'm actually working in AppleScript Studio and am just passing
parameters on to some custom C class to then pass to Growl, I tried Image
Events first with just plain scaling but it looked horrible (as if it tried
to scale the tiny image without the high res content).
I've scoured google and tried a number of solutions trying to set the image
size to the size of its bitmap representation, such as this, without luck
(still looks tiny):
NSImage *myImage = [NSImage alloc];
myImage = [myImage initWithContentsOfFile:aPath];
NSBitmapImageRep *rep = [[myImage representations] objectAtIndex:0];
int renderedWidth = [rep pixelsWide];
int renderedHeight = [rep pixelsHigh];
//[rep setSize:NSMakeSize(renderedWidth, renderedHeight)];
[myImage setSize:NSMakeSize(renderedWidth, renderedHeight)];
//[myImage addRepresentation:rep];
//[myImage removeRepresentation:[[myImage representations]
objectAtIndex:0]];
(I've tried with and without the commented-out lines.)
Ultimately I have to pass the TIFF representation to Growl, which I suspect
further complicates this:
iconData:[myImage TIFFRepresentation]
I need a general solution where I can pass any image file path to this
method and get the "right" image data to pass to Growl.
I'm a cocoa newbie (going on week 2 here ;-) so image processing is pretty
far over my head already but I'm catching on!
I've posted about this at the Growl forums but have not found a resolution
yet (though PH has been helpful) and would very much like to move on!
http://forums.cocoaforge.com/viewtopic.php?f=6&t=16005&p=106701
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden