Here's a simple method for resizing. I made it a category of NSImage.
- (NSImage *)resizedImageForSize:(NSSize)size
{
NSImage *resizedImage = [[[NSImage alloc] initWithSize:size] autorelease];
[resizedImage lockFocus];
[self drawInRect:[resizedImage bounds] fromRect:[self bounds]
operation:NSCompositeSourceOver fraction:1.0];
[resizedImage unlockFocus];
return resizedImage;
}
--- On Thu, 12/11/08, Glenn Bloom <[email protected]> wrote:
> From: Glenn Bloom <[email protected]>
> Subject: Resizing an image
> To: [email protected]
> Date: Thursday, December 11, 2008, 5:43 AM
> Can anyone recommend a best practice for resizing an image
> to reduce its
> size in terms of both bytes and visible dimensions,
> retaining the new
> smaller image and eliminating the original from memory? In
> how I go about
> this now, I am concerned about memory and efficiency.
>
> thanks in advance for any help,
>
> Glenn
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/howlewere%40yahoo.com
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]