• 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: Robert Dell <email@hidden>
  • Date: Sun, 22 Jan 2006 07:09:50 -0500

Heinrich Giesen wrote:


On 22.01.2006, at 09:54, Eamon Ford wrote:


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.


That's an overkill.

There really should be an easier way to do it.


Please remember that the natural incarnation (object) of
the data of an image file is an object of one of the subclasses
of NSImageRep and not an NSImage. Locking, drawing, unlocking
wastes a lot of time and space; this will work:

NSBitmapImageRep *theRep = ...;

why dont people like to finish out a line? it's almost as if they are speaking off-the-cuff and have no idea if it will work. at least that's the impression i get when somebody does that.

// get the rep from the file or:
// in most cases [theOriginalImage objectAtIndex:0] will do it
// but it must be an NSBitmapImageRep
[theRep setSize:theNewSize];
[[theRep representationUsingType:NSJPEGFileType properties:nil] // or another type
writeToFile:fileName atomically:YES];


The best way to change the size (i.e. the resolution) of an image is
the way sips goes. But sips has some bugs and is not uptodate (Tiger).


_______________________________________________ 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
  • Follow-Ups:
    • Re: Resizing an image
      • From: Heinrich Giesen <email@hidden>
References: 
 >Re: Resizing an image (From: Heinrich Giesen <email@hidden>)

  • Prev by Date: Re: Resizing an image
  • Next by Date: Searching a controller's content
  • Previous by thread: Re: Resizing an image
  • Next by thread: Re: Resizing an image
  • Index(es):
    • Date
    • Thread