Re: Raw pixel data <-> jpeg
Re: Raw pixel data <-> jpeg
- Subject: Re: Raw pixel data <-> jpeg
- From: Jean-Daniel Dupas <email@hidden>
- Date: Mon, 10 Mar 2008 09:41:03 +0100
Le 10 mars 08 à 09:18, Trygve Inda a écrit :
I have raw pixel data in a block of memory of the form ARGB. I need to
convert this to a jpg and write it to disk. I can obviously provide
the
width and height which match the amount of pixel data.
I also need to go the other way... Reading a jpg from disk and
getting at an
ARGB (or even just RGB) pixel buffer.
I have not been able to find good sample code to do this... Is there
any out
there? I saw one page about ImageIO but few details.
If there is no sample code, what then are the steps so I can piece it
together myself?
Thanks,
Trygve
I think there is some sample on developer.apple.com.
Anyway, to convert your argb data, create an NSBitmapImageRep.
There is a constructor that expects a raw data buffer.
initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel
:
To convert it back, don't know if it works, but you can try +
[NSBitmapImageRep imageRepWithData:]
_______________________________________________
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