• 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: Obtaining unpremultiplied bitmap from PNG file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining unpremultiplied bitmap from PNG file


  • Subject: Re: Obtaining unpremultiplied bitmap from PNG file
  • From: Chiharu Hirono <email@hidden>
  • Date: Tue, 19 Jun 2007 02:11:35 +0900

Thank you for quick responses.

The final goal of may app is to make smaller picture from original
picture without modifying RGBA or gamma or resizing.

I tried this using these step:
1) Make NSImage from original picture file
2) Alloc output NSImage
3) Using compositeToPoint copy an area of original image to output image
4) Get TIFFRepresentation from output image
5) Make NSBitmapImageRep using TIFF data
6) Get encoded data from NSBitmapImageRep using representationUsingType
7) Write data to file

But this method made modified RGB.
My purpose is not get RGBA pixcel values, but get picture with original RGBA.
Can CGImageRef solve this problem?



On 2007/06/15, at 2:57, David Duncan wrote:

On Jun 13, 2007, at 2:28 PM, Shamyl Zakariya wrote:

As far as I can tell, Cocoa simply won't give you non- premultiplied bitmap data. The CG constant kCGImageAlphaLast ( IIRC ) is there, but isn't actually implemented.

kCGImageAlphaLast is implemented and fully supported for creating a CGImageRef. What is not implemented is creating a bitmap context (via CGBitmapContextCreate) that does not use pre-multiplied alpha. The distinction is subtle, but practically it means that you can create an image that does not used pre-multiplied alpha, but in the current API you cannot obtain the pixel data from that image into your own buffer without getting it pre-multiplied.


On Jun 14, 2007, at 2:34 AM, Barry wrote:
How do I access the pixel data of a CGImage object?
at
http://developer.apple.com/qa/qa2007/qa1509.html

Is this a solution ???

This Q&A demonstrates obtaining the pixel data via a bitmap context, which as above requires you to work with pre-multiplied data.
--
David Duncan
Apple DTS Quartz and Printing
email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
net.ne.jp


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Obtaining unpremultiplied bitmap from PNG file
      • From: David Duncan <email@hidden>
References: 
 >Obtaining unpremultiplied bitmap from PNG file (From: Chiharu Hirono <email@hidden>)
 >Re: Obtaining unpremultiplied bitmap from PNG file (From: Shamyl Zakariya <email@hidden>)
 >Re: Obtaining unpremultiplied bitmap from PNG file (From: David Duncan <email@hidden>)

  • Prev by Date: Re: can't set focus feature on IIDC isight camera
  • Next by Date: Re: can't set focus feature on IIDC isight camera
  • Previous by thread: Re: Obtaining unpremultiplied bitmap from PNG file
  • Next by thread: Re: Obtaining unpremultiplied bitmap from PNG file
  • Index(es):
    • Date
    • Thread