Click here to Skip to main content
11,806,026 members (61,754 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VC6 C++
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)

  Print Answers RSS
0 Richard Deeming 225
1 OriginalGriff 215
2 Sergey Alexandrovich Kryukov 170
3 Abhinav S 120
4 ppolymorphe 115
0 OriginalGriff 3,330
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,905
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web04 | 2.8.151002.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