Re: Resizing an image
Re: Resizing an image
- Subject: Re: Resizing an image
- From: Eamon Ford <email@hidden>
- Date: Sun, 22 Jan 2006 00:53:47 -0800
I found out how to do it: you have to create a new NSImage of the
desired size, lock focus on it, and draw the original image into the
new one. More information here, in case anyone's interested: <http://
weblog.scifihifi.com/2005/06/25/how-to-resize-an-nsimage>
There really should be an easier way to do it.
From: Ricky Sharp <email@hidden>
To: Eamon Ford <email@hidden>
Cc: Cocoa Dev List Cocoa-Dev <email@hidden>
Date: Sat Jan 21, 2006 04:13:58 PM PST
Subject: Re: Resizing an image
On Jan 21, 2006, at 5:51 PM, Eamon Ford wrote:
How do I resize an image, and make it keep the new size, not just
for drawing? So if I save it to disk and then open it, it'll be
that size. I can't find any methods for doing this. Do I need to
use CoreImage?
Assuming you're working with bitmapped images...
NSImage* theOriginalImage = ...
[theOriginalImage setScalesWhenResized:YES];
[theOriginalImage setSize:theDesiredSize];
Obtain the bitmap rep from the image and call
representationUsingType:properties:. This will obtain an instance of
NSData that can ultimately be written out to a file.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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