By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 820 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

PNG tEXt Chunk

P: 91
I'm trying to get the tEXt comment chunk from inside a png image. I can see the text if I open the .png file in a text editor however right clicking on it and going to properties doesn't show it there.

Am I just going to have to open the .png as a stream and go byte by byte or is there any references or methods that can obtain it for me?
Dec 29 '08 #1
Share this Question
Share on Google+
5 Replies

Expert 5K+
P: 5,000
Are you trying this in C#? What have you tried already?
Dec 29 '08 #2

P: 91
Yes I am trying it in C#. I had tried basically what is on PngBitmapDecoder Class (System.Windows.Media.Imaging)

with like decoder.MetaData.Comment and such.

I tried opening the .png file with FileStream and StreamReader however it isn't reading the file fully when I convert it back to string so I am unsure how I should search the data for 'tEXtcomment'. I wish C# had png chunk methods :-\
Dec 29 '08 #3

Expert 5K+
P: 5,000
I don't understand what you are trying to do. You are trying to decode a PNG file into a BMP file then output it as a string?
Dec 30 '08 #4

P: 91
No what I am trying to do is take a PunkBuster screenshot which has information at the bottom of the screen which is also encoded in the tEXt chunk of the png file and grab that info. If I open the .png file with a text editor I can see in plain text the information I need in the tEXt Chunk. I see there is a plugin for Delphi which you just specify which chunk you want and it will grab the info without having to walk the file. I am looking for a fast and easy way to get the tEXt chunk of the png file.

Yesterday I tried walking the file and it did not turn out exactly the way I wanted it too.

Here is an example of the first couple lines of the png file in a text editor.
Attached Images
File Type: png tEXtpng.PNG (57.1 KB, 509 views)
Dec 30 '08 #5

Expert 5K+
P: 5,000
That image is too small. If the plugin from Delphi works then why not use that?
Dec 30 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.