• 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: cutting an image into multiple images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cutting an image into multiple images


  • Subject: Re: cutting an image into multiple images
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 21 Jun 2008 18:47:04 -0500

On Jun 21, 2008, at 8:41 AM, Dharmendra wrote:

I am trying to get a user-defined image in specific format (m x nm) and want
to generate an array with count n containing m x m sized images. I have
written the following code, but would like to know if there is better way to
do the same:

Rather than using NSImage, which is really about drawing, you might consider using NSBitmapImageRep directly. Initialize the source from the file data. Then, initialize each sub-image using one of the initWithBitmapDataPlanes:... methods, obtaining the arguments by querying the source and performing a bit of math on the planes value.


That said, read the caveat in the NSBitmapImageRep class overview:

Alpha Premultiplication
If a coverage (alpha) plane exists, a bitmap’s color components are premultiplied with it. If you modify the contents of the bitmap, you are therefore responsible for premultiplying the data. For this reason, though, if you want to manipulate the actual data, an NSBitmapImageRep object is not recommended for storage. If you need to work with unpremultiplied data, you should use Quartz, specifically CGImageCreate with kCGImageAlphaLast.



That caveat would apply to NSImage, too, because it's based on NSBitmapImageRep.


Cheers,
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


References: 
 >cutting an image into multiple images (From: Dharmendra <email@hidden>)

  • Prev by Date: Re: Bindings Concept Question
  • Next by Date: Data backend for larger apps
  • Previous by thread: Re: cutting an image into multiple images
  • Next by thread: Why does this https post request always return "404 Not Found"
  • Index(es):
    • Date
    • Thread