Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

iam coverting a Image to PNG ,in that i like to add/insert chunk data into that file.
chunk is block of data to be dispalyed in the image .

Please help in this regards


Thanks
Posted
Comments
enhzflep 25-Apr-12 1:48am    
Can you elaborate on what you mean by "add/insert chunk data"?
Do you mean you'd like to copy another smaller image into the image in question?

If so - load image, create compatible DC, select image into DC, bitblt other image into desired position.
JOYKAIGA1 25-Apr-12 2:08am    
adding/insert chunk means like to add text/label into the image

1 solution

PNG does support comment / text chunks. but, there is no mechanism in the PNG spec to tell a reader how to display that text. and you could probably define your own custom chunk type, if you have non-ASCII data to store. but again, there is nothing to tell viewers how to display your data.
 
Share this answer
 
Comments
JOYKAIGA1 26-Apr-12 0:36am    
what is the solution to add an extra chunk in the image?can you tell me how to define own custom chunk type ?
Chris Losinger 26-Apr-12 7:38am    
you can use a tool like pngsplit to insert a custom chunk into an existing image. to add a new chunk to an image while you're writing it, use png_write_chunk (after png_write_info, IIRC).
JOYKAIGA1 26-Apr-12 9:18am    
can you brief more about this in which file to be added ?
Chris Losinger 26-Apr-12 9:38am    
i'm assuming you're using pngLib to create your PNG file. so, you would do the png_write_chunk wherever you are doing all the other libPng stuff.

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