axel22
axel22

Reputation: 32345

Getting text stored within a PNG Image in Java

According to this Wikipedia entry on the PNG format, a PNG image file can have embedded text stored in its tEXt chunks. This allows storing some text along with the image, which isn't visible in the image itself, but is hidden within the file.

Question is: how can I read these name=value pairs from a PNG file using the Java2D api? Does the ImageReader class help me here? Can anyone produce a short snippet?

Thank you!

Upvotes: 2

Views: 1242

Answers (2)

leonbloy
leonbloy

Reputation: 76026

PNGJ library lets you read/write the three types of textual chunks.

Upvotes: 2

Sandro
Sandro

Reputation: 1276

This should be possible with javapng.

Use com.sixlegs.png.PngImage#getTextChunk(String).

Upvotes: 4

Related Questions