Jump to content

png compressed text in zTXt chunk


Recommended Posts

I have a png image in which there this block




I know that in the zTXt there is a text according to this :



A zTXt chunk contains:

Keyword 1-79 bytes (character string) Null separator 1 byte (null character) Compression method 1 byte Compressed text datastream n bytes


Keyword = Email

Null separator is = 00

Compression method is 00


and from x = 78 in hexadecimal until IEND the end of the file it is the text data stream :




So I would like to decode the above text data stream to make it readable but I am unable to do it .


Please help

Link to comment
Share on other sites

You need two things:

1. The specification which indicates which compression algorithm 0 refers to

2. A program that will run that algorithm on the string.


Since the string probably contains some non-printable characters, what you've posted on the forum probably won't work, you need to get the specific bytes from the file and pass them through the decompression algorithm.

Link to comment
Share on other sites

ok after some researches ; I found that the ZLIB library decompresses the data above . So I downloaded the version 1.2.8 from this site :




li_blue.pngzlib source code, version 1.2.8, tar.gz format (558K, MD5 checksum 44d667c142d7cda120332623eab69f40):


then I read some articles on how to use it :


like this :








and some others


but I am more confused and stuck then before as it seems that some programming skills are involved in C and C++ and it is not a normal software . I have the zlib 1.2.8 installed in my pc (with windows xp) but I do not know how to use it even after reading many articles and the documentation that comes installed with zlib . Could you please provide me step by step on how to use the zlib file installed in my pc to decompress the datastream above in my png photo . As a newbie I am really stuck and cannot find my way :(


best regards and happy new year for both you justsomeguy and Foxy Mod :)

Link to comment
Share on other sites

Zlib is a compression library, you use it to write a C/C++ program that supports zlib compression. If you want to read the metadata from a PNG file, then find a program specifically for that, there are several available. ImageMagick is one program that will display PNG metadata.

Link to comment
Share on other sites

I want to be able to make the text datastream in the zTXt chunk of a png readable . does ImageMagick decompress the compressed text in the zTXt chunk of a png and make it readable for me ? if not , which uncomplicated software , justsomeguy, do you suggest me to use to make the text under zTXt chunk readable if we take in consideration that the compression method is inflate/deflate compression in zlib format according to this :




?? :(

Link to comment
Share on other sites

ok I used ImageMagick as you told me and tried to read the metadata :


this is a sample :


Background color: srgba(254,254,254,1)
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 644x445+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
date:create: 2015-12-30T00:19:33+01:00
date:modify: 2015-12-30T00:19:34+01:00


So the compression used is ZIP . The problem is that I do not know how to decompress a png compressed using zip compression . Justsomeguy could you help me please .



Link to comment
Share on other sites

If you're an end-user then you find a piece of software for viewing PNG metadata that will show everything, including custom metadata.




If you're a programmer and you want to write a program to do that, then that is where you need to use things like zlib and the PNG specification to write the code to extract all of that information.

Link to comment
Share on other sites

I would like to know how to decompress a png image and not to view its metadata :) what is the name of the software which I can use to decompress a png image that is compressed using zip compression? I could not find helpful resources in google :(

Edited by hisoka
Link to comment
Share on other sites

If someone zipped a PNG image, then you use any unzipping tool (e.g. 7-zip) to unzip the .zip file and get the .png file out of the zip archive.


But that's not what you want to do, is it? Instead you print out the metadata, see "zip" listed for the compression, and think that you can somehow "unzip" the PNG image. What exactly do you expect to see once you do that? The image data is compressed to make the file smaller, if you remove the compression you'll most likely end up with a string of binary digits (or whatever the PNG specification says about the raw data). So, what's the point? What specifically are you trying to do? If you're trying to read the zTXt data, that's metadata. If that's not what you're trying to do, what are you trying to do? Is this some steganography question?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...