• 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: Scaling an NSImage to have exact pixel dimensions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scaling an NSImage to have exact pixel dimensions


  • Subject: Re: Scaling an NSImage to have exact pixel dimensions
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 09 Oct 2014 22:05:40 -0500

On Oct 9, 2014, at 9:08 PM, Carl Hoefs <email@hidden> wrote:

> I need to scale an NSImage's dimensions to exactly 640x480 pixels before sending it remotely for processing.

> What is the correct way to do this?

Create an NSBitmapImageRep with the appropriate properties.  Create an NSGraphicsContext from that bitmap image rep using +[NSGraphicsContext graphicsContextWithBitmapImageRep:].  Make that graphics context current.  Draw the image.  Flush and restore the graphics context.  Get the data from the bitmap image rep in an image file format using -representationUsingType:properties: or (if you really want TIFF) -TIFFRepresentationUsingCompression:factor:.

Regards,
Ken


_______________________________________________

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: Scaling an NSImage to have exact pixel dimensions
      • From: Carl Hoefs <email@hidden>
References: 
 >Scaling an NSImage to have exact pixel dimensions (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Scaling an NSImage to have exact pixel dimensions
  • Next by Date: Self KVO...
  • Previous by thread: Scaling an NSImage to have exact pixel dimensions
  • Next by thread: Re: Scaling an NSImage to have exact pixel dimensions
  • Index(es):
    • Date
    • Thread