Re: Resizing an image
Re: Resizing an image
- Subject: Re: Resizing an image
- From: Ian was here <email@hidden>
- Date: Thu, 11 Dec 2008 22:35:41 -0800 (PST)
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@hidden> wrote:
> From: Glenn Bloom <email@hidden>
> Subject: Resizing an image
> To: email@hidden
> 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@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
_______________________________________________
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