What software can I use to read png metadata?

56

10

I know that I can create a simple little Qt based application that adds and read png metadata, using the QImage.setText(...) and QImage.text(...). That metadata can then be read with a linux command called pngmeta.

But what other image software can I use to read out the png metadata?

Please note that I'm seeking image programs for the common platforms, so please specify if your application is for Windows or Linux.

To make the question clearer I attached a img with some test metadata attached to it.

The img with meta data

Thanks Johan


Links:

Johan

Posted 2010-12-08T08:48:57.020

Reputation: 4 827

Question was closed 2019-01-09T11:55:57.417

Answers

80

Using ImageMagick:

identify -verbose image.png

ImageMagick should be cross-platform. I tried it on Linux with your attached image:

[...]
Properties:
  Author: Hans Müller
  Date: 2010-12-08 09:45
  date:create: 2010-12-08T13:15:43+01:00
  date:modify: 2010-12-08T13:15:43+01:00
  Desc: A long time ago in a galaxy far far away....
  signature: 3b4a54202316a7ae4b4fe0e431d47958181f4bb893493355820d4ba74f9f5ee3
[...]

cYrus

Posted 2010-12-08T08:48:57.020

Reputation: 18 102

FYI: This will not detect animated PNG files as of Nov,2017, you need to look for acTL etc using pngcheck or something ... – Mike Q – 2017-11-06T16:16:21.133

Note however that some of those fields are not actual extra metadata present in the file data: date:create and date:modify simply return the file system metadata, and signature calculates a hash of the image data. – Ciro Santilli 新疆改造中心法轮功六四事件 – 2018-11-30T15:44:41.103

2Glad to help. ImageMagick suite can do much more, it's worth to spend some time with it IMO. – cYrus – 2010-12-08T13:34:08.880

16

Another option is TweakPNG, on Windows.

I can see that is having problems displaying the Hans Müller name in your image, so maybe it does not work with Unicode metadata.

TweakPNG

paradroid

Posted 2010-12-08T08:48:57.020

Reputation: 20 970

great app, nice & simple – yarg – 2016-04-14T07:26:40.987

1I added a string with a ü since it felt like a good idea. – Johan – 2010-12-08T14:20:49.693

2

FYI, TweakPNG works nice inside Wine.

– Denilson Sá Maia – 2013-09-10T00:20:18.090

11

If you are looking for a PNG-only solution, try pngchunks:

$ sudo apt-get install pngtools
$ pngchunks UiagX.png
Chunk: Data Length 13 (max 2147483647), Type 1380206665 [IHDR]
  Critical, public, PNG 1.2 compliant, unsafe to copy
  IHDR Width: 800
  IHDR Height: 600
  IHDR Bitdepth: 8
  IHDR Colortype: 2
  IHDR Compression: 0
  IHDR Filter: 0
  IHDR Interlace: 0
  IHDR Compression algorithm is Deflate
  IHDR Filter method is type zero (None, Sub, Up, Average, Paeth)
  IHDR Interlacing is disabled
  Chunk CRC: 353637671
Chunk: Data Length 9 (max 2147483647), Type 1935231088 [pHYs]
  Ancillary, public, PNG 1.2 compliant, safe to copy
  ... Unknown chunk type
  Chunk CRC: 10132504
Chunk: Data Length 19 (max 2147483647), Type 1951942004 [tEXt]
  Ancillary, public, PNG 1.2 compliant, safe to copy
  ... Unknown chunk type
  Chunk CRC: -1325924661
Chunk: Data Length 21 (max 2147483647), Type 1951942004 [tEXt]
  Ancillary, public, PNG 1.2 compliant, safe to copy
  ... Unknown chunk type
  Chunk CRC: 134517081
Chunk: Data Length 58 (max 2147483647), Type 1951945850 [zTXt]
  Ancillary, public, PNG 1.2 compliant, safe to copy
  ... Unknown chunk type
  Chunk CRC: 1701487776
Chunk: Data Length 572939 (max 2147483647), Type 1413563465 [IDAT]
  Critical, public, PNG 1.2 compliant, unsafe to copy
  IDAT contains image data
  Chunk CRC: 1174233759
Chunk: Data Length 0 (max 2147483647), Type 1145980233 [IEND]
  Critical, public, PNG 1.2 compliant, unsafe to copy
  IEND contains no data
  Chunk CRC: -1371381630

The output of pnginfo may not verbose enough for your usage:

$ pnginfo UiagX.png
UiagX.png...
  Image Width: 800 Image Length: 600
  Bitdepth (Bits/Sample): 8
  Channels (Samples/Pixel): 3
  Pixel depth (Pixel Depth): 24
  Colour Type (Photometric Interpretation): RGB 
  Image filter: Single row per byte filter 
  Interlacing: No interlacing 
  Compression Scheme: Deflate method 8, 32k window
  Resolution: 2835, 2835 (pixels per meter)
  FillOrder: msb-to-lsb
  Byte Order: Network (Big Endian)
  Number of text strings: 3 of 9
    Author (tEXt uncompressed): Hans Müller
    Date (tEXt uncompressed): 2010-12-08 09:45
    Desc (tEXt uncompressed): A long time ago in a galaxy far far away....

malat

Posted 2010-12-08T08:48:57.020

Reputation: 981

Where do I find pngchunks? – Iulian Onofrei – 2015-02-12T12:43:48.457

@IulianOnofrei updated – malat – 2015-02-12T13:44:36.847

pngcheck doesn't appear to be able to decompress ztxt segments – RobM – 2019-06-25T10:40:44.297

7

I can't see Exiftool mentioned above.
It does many image formats, not just png...
It is a "platform independent perl module", but also an executable (available for several platforms/OS).

More info: http://www.sno.phy.queensu.ca/~phil/exiftool/

Hannu

Posted 2010-12-08T08:48:57.020

Reputation: 4 950

4

As mentioned in another question, you can use pngcheck:

pngcheck -c -v -t foobar.png

These are the relevant options for showing PNG chunks:

-7  print contents of tEXt chunks, escape chars >=128 (for 7-bit terminals)
-c  colorize output (for ANSI terminals)
-p  print contents of PLTE, tRNS, hIST, sPLT and PPLT (can be used with -q)
-t  print contents of tEXt chunks (can be used with -q)
-v  test verbosely (print most chunk data)

Denilson Sá Maia

Posted 2010-12-08T08:48:57.020

Reputation: 9 603

2

  1. Using imagemagick for both adding the comment:

    mogrify -comment "your comment" <IMAGE_NAME>
    
  2. Then reading it back:

    identify -verbose <IMAGE_NAME>
    

Or, if you want to see only the comment:

identify -verbose <IMAGE_NAME> | grep "comment:"

It's a good practice to embed the metadata properly.

user327322

Posted 2010-12-08T08:48:57.020

Reputation: 21

I was using convert to accomplish this so I could create a new version, but I had not gotten to mogrify yet, thanks!

convert filename.png -set comment "That rabbits dynamite!" filename.png; – roberthuttinger – 2017-10-11T15:41:23.390

identify only works for known properties. Any custom tags won't show up. – TJR – 2019-08-24T03:27:55.400

1

In case someone is using Magick.NET, you can get those attributes in C# like this:

foreach(string key in image.AttributeNames)
{
    string value = image.GetAttribute(key);
}

yazanpro

Posted 2010-12-08T08:48:57.020

Reputation: 111