• 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: Crop an image in memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crop an image in memory


  • Subject: Re: Crop an image in memory
  • From: Greg Titus <email@hidden>
  • Date: Fri, 3 Jan 2003 18:55:24 -0800

On Friday, January 3, 2003, at 10:34 AM, Giovanni Donelli wrote:

Happy new years Gurus!
I have an NSImage suppose 200x200px when I set its size to 40x40px in memory the image has the same size in fact I can resize it again and get back the original quality...

How do I really RESIZE the image so that the memory is also freed ??? I guess there's a flag somewhere to set...

Actually, no, you'll have to make a new image and composite the existing image into it, like so:

NSImage *newImage;

newImage = [[NSImage alloc] initWithSize:NSMakeSize(40, 40)];
[newImage lockFocus];
[oldImage compositeToPoint:NSZeroPoint fromRect:NSMakeRect(0, 0, 200, 200) operation:NSCompositeCopy];
[newImage unlockFocus];

Then you can get rid of the old image, if desired.

Hope this helps,
- Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Crop an image in memory (From: Giovanni Donelli <email@hidden>)

  • Prev by Date: Re: Ignoring an empty field in the address book
  • Next by Date: Re: Find out what's wrong with an NSString?
  • Previous by thread: Crop an image in memory
  • Next by thread: Problem with bsd sockets
  • Index(es):
    • Date
    • Thread