• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resizing an image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Resizing an image
      • From: "Glenn Bloom" <email@hidden>
References: 
 >Resizing an image (From: "Glenn Bloom" <email@hidden>)

  • Prev by Date: Re: Blunt edges to Window
  • Next by Date: Re: Core Data warning: to-many relation does not have an inverse
  • Previous by thread: Re: Resizing an image
  • Next by thread: Re: Resizing an image
  • Index(es):
    • Date
    • Thread