• 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: Eamon Ford <email@hidden>
  • Date: Sun, 22 Jan 2006 00:53:47 -0800

I found out how to do it: you have to create a new NSImage of the desired size, lock focus on it, and draw the original image into the new one. More information here, in case anyone's interested: <http:// weblog.scifihifi.com/2005/06/25/how-to-resize-an-nsimage>

There really should be an easier way to do it.


From: Ricky Sharp <email@hidden>
To: Eamon Ford <email@hidden>
Cc: Cocoa Dev List Cocoa-Dev <email@hidden>
Date: Sat Jan 21, 2006 04:13:58 PM PST
Subject: Re: Resizing an image


On Jan 21, 2006, at 5:51 PM, Eamon Ford wrote:

How do I resize an image, and make it keep the new size, not just
for drawing? So if I save it to disk and then open it, it'll be
that size. I can't find any methods for doing this. Do I need to
use CoreImage?

Assuming you're working with bitmapped images...

NSImage* theOriginalImage = ...

[theOriginalImage setScalesWhenResized:YES];
[theOriginalImage setSize:theDesiredSize];

Obtain the bitmap rep from the image and call
representationUsingType:properties:.  This will obtain an instance of
NSData that can ultimately be written out to a file.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Resizing an image (From: Eamon Ford <email@hidden>)
 >Re: Resizing an image (From: Ricky Sharp <email@hidden>)

  • Prev by Date: NSToolbar bindings?
  • Next by Date: Re: NSToolbar bindings?
  • Previous by thread: Re: Resizing an image
  • Next by thread: Re: Resizing an image
  • Index(es):
    • Date
    • Thread