• 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: Decompressing JPEG data into specific format, getting raw pixels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decompressing JPEG data into specific format, getting raw pixels


  • Subject: Re: Decompressing JPEG data into specific format, getting raw pixels
  • From: "Sean McBride" <email@hidden>
  • Date: Thu, 17 Aug 2017 18:24:59 -0400
  • Organization: Rogue Research Inc.

On Wed, 16 Aug 2017 18:39:56 -0500, Ken Thomases said:

>On Aug 16, 2017, at 6:29 PM, Sean McBride <email@hidden> wrote:
>>
>>
>> Right, but then I'm back where I started. :(  Because there's
>(apparently) no way to ensure that the NSBitmapImageRep I get is in a
>particular format, and I absolutely need 8 bit per pixel & greyscale.
>
>It's quite old now, but the 10.6 AppKit release notes had a lot of good
>information about working with images in Cocoa viz. Core Graphics.  From
><https://developer.apple.com/library/content/releasenotes/AppKit/RN-
>AppKitOlderNotes/#X10_6Notes>, search for "NSImage, CGImage, and
>CoreGraphics impedance matching" and read from there.
>
>They also have advice about what you're trying to do.  The advice is to
>*not* try to interpret an arbitrary image rep's bitmap data.  It's to
>make a bitmap with the format you desired and draw the source image into
>it.  Then, you have bitmap data in the format you want, for sure.  For
>that, search for "NSBitmapImageRep: CoreGraphics impedance matching and
>performance notes".

Thanks, that's quite helpful!  I know I've read it before, but forgot to
recheck those release notes, they sure are great, I'm glad Apple writes them!

I also found 'QA1509: Getting the pixel data from a CGImage object' which is
even older, but was useful too.

I also found vImageBuffer_InitWithCGImage() which has been great!

So my typical data is 1280x1024.  With NSBitmapImageRep I can't get it into an
NSData in 30 ms, whereas with CGImageCreateWithJPEGDataProvider() +
vImageBuffer_InitWithCGImage() it takes only 9 ms and produces byte-for-byte
identical results interestingly enough.  I suspect bitmapData makes a copy
somewhere.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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: 
 >Decompressing JPEG data into specific format, getting raw pixels (From: "Sean McBride" <email@hidden>)
 >Re: Decompressing JPEG data into specific format, getting raw pixels (From: Doug Hill <email@hidden>)
 >Re: Decompressing JPEG data into specific format, getting raw pixels (From: "Sean McBride" <email@hidden>)
 >Re: Decompressing JPEG data into specific format, getting raw pixels (From: Doug Hill <email@hidden>)
 >Re: Decompressing JPEG data into specific format, getting raw pixels (From: "Sean McBride" <email@hidden>)
 >Re: Decompressing JPEG data into specific format, getting raw pixels (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Decompressing JPEG data into specific format, getting raw pixels
  • Next by Date: NSUserDefault controller bindings - observeValueForKeyPath called twice?
  • Previous by thread: Re: Decompressing JPEG data into specific format, getting raw pixels
  • Next by thread: Re: Decompressing JPEG data into specific format, getting raw pixels
  • Index(es):
    • Date
    • Thread