Click here to Skip to main content
16,016,759 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

My MFC application generates PDF's and now I'm trying to add support to PNG files with transparency.

I'm starting with just using the entry /Mask to mask one color.

What I have tried:

I extracted the IDAT chunk of the PNG and added to the object stream and used the "transparent color" (which I obtained with FreeImage) in the /Mask entry.

My PDF image object:

6 0 obj
<<
/Type /XObject
/Subtype /Image
/Name /Im1
/Width 60
/Height 23
/BitsPerComponent 8
/Length 484
/ColorSpace /DeviceRGB
/Filter /FlateDecode
/Mask [0 0 0 0 0 0]
>>
stream
    % IDAT CHUNK %
endstream
endobj


I also tried adding the tRNS chunk to the stream of a XObject and using SMask but that didn't work.


I'm starting with the "color key mask" because I believe it's the easiest one. I know this is a very broad question but any hint or direction will be very appreciated.

This is my PDF and I'm using this image to test.

Thanks!
Posted
Updated 31-Jul-18 14:16pm
v2

1 solution

 
Share this answer
 
Comments
LiquidPenguin 1-Aug-18 7:22am    
Hi, Thank you for the answer, but I want to do it myself and not to use a lib, and as far I could see they don't show the code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900