Re: Fastest way to resize an image?
Re: Fastest way to resize an image?
- Subject: Re: Fastest way to resize an image?
- From: Jean-Nicolas Jolivet <email@hidden>
- Date: Thu, 20 Nov 2008 12:30:44 -0500
It didn't actually....
The problem was that, with certain images (only a small percentage) I
would get a size that is *totally* off...
keep in mind I have to draw them anyway because I'm also drawing a
border around the image (basically just resizing the image down a bit
and filling the background before I draw the image)... however, some
images ended up like 1/3rd of the size they should've been after being
drawn...
I found out that [NSImage size] wasn't really reliable since basically
from what I understand it depends on the ImageRep's DPI etc.... so the
only way I can get a reliable size for the image is to load it in a
BitmapImageRep and check its pixelsWide and pixelsHigh... that way I
get the actual image size in pixel...
Good thing I tested it with a lot of images or I probably would've
missed it and use NSImage all the way....
On 20-Nov-08, at 12:23 PM, Randall Meadows wrote:
On Nov 19, 2008, at 11:51 PM, Ken Ferry wrote:
however I found out that just using the setSize: method of NSImage
was unreliable
-[NSImage setSize:] doesn't change the pixels of an image, it changes
the natural size that the image is drawn at. If you try to write the
NSImage back out as a TIFF, say, then what you've done is modify the
DPI.
Does setting -setScalesWhenResized: appropriately help in this
situation?
Jean-Nicolas Jolivet
email@hidden
http://www.silverscripting.com
_______________________________________________
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