Click here to Skip to main content
11,642,381 members (65,237 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VC6
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

Posted 24-Apr-12 19:02pm
enhzflep at 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.
Jedson at 25-Apr-12 2:08am
adding/insert chunk means like to add text/label into the image

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Tony Joy at 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 at 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).
Tony Joy at 26-Apr-12 9:18am
can you brief more about this in which file to be added ?
Chris Losinger at 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)

Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 25 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100