• 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: Completely resizing NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Completely resizing NSImage


  • Subject: Re: Completely resizing NSImage
  • From: matt neuburg <email@hidden>
  • Date: Mon, 29 Mar 2004 12:15:49 -0800

On Fri, 26 Mar 2004 09:41:15 +0100, Michael Becker <email@hidden>
said:
>My application has to deal with a lot of image thumbnail which it
>generates. I didn't really think much about it, but recently I've read
>on this list, that -setSize: doesn't "truly" resize the image, only a
>representation of it (as far as i remember).
>I've checked my application's memory usage using the unix "top"
>command, only to realise in shock that when holding about 40 thumbnails
>it uses more than 100 MB of memory.
>
>I've replaced the -setSize: call with creating another NSImage through
>"initWithSize:" and then drawing the old image into the new one and
>releasing the old one. Now my application will use only about 10 MB
>when holding about 80 images. So that's a good thing :-)
>
>My question: Are there any other "traps" when dealing with NSImage? Are
>there any switches or the like for turning off any additional
>complexity?

I too have a thumbnail-generating app, and I found that I didn't even need
NSImage to make the thumbnails. I just read the images from disk into an
NSBitmapImageRep, create the thumbnail into my "master" NSImage using
drawRect:, and release the bitmap. This avoids the overhead of an NSImage's
unwanted representations and caching behavior. m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide! NOW SHIPPING...! (Finally.)
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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.


  • Prev by Date: Re: Clever way to replace in a NSString
  • Next by Date: Re: [ANN] Shovel - Third-Party "Software Update"
  • Previous by thread: Completely resizing NSImage
  • Next by thread: accessing an Array Controller, Doc based app.
  • Index(es):
    • Date
    • Thread