can png file store information using IM

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

can png file store information using IM

Post by linjuming »

For example, I want to keep some information such as
"author : linjuming"
in the hello.png
Then next time I can use "identify -verbose hello.png" or some other command to find these informations.
Can IM do this job?

Code: Select all

D:\phpnow\htdocs\laji>identify -verbose kk.png
Image: kk.png
  Format: PNG (Portable Network Graphics)
  Class: PseudoClass
  Geometry: 20x128+0+0
......
Author : linjuming
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: can png file store information using IM

Post by fmw42 »

see http://www.imagemagick.org/script/comma ... .php#label

convert logo: -set label "testing" logo.png
identify -verbose logo.png
...
Properties:
date:create: 2011-10-30T21:35:45-07:00
date:modify: 2011-10-30T21:35:45-07:00
label: testing
...
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: can png file store information using IM

Post by linjuming »

very great ! thank you.
and can identify output shorter infos?
the command identify -verbose output too logo informations while i only need the str "author : linjuming".
how many options for identify command ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: can png file store information using IM

Post by anthony »

The PNG image file format can actually store a lot of different information.
See Montage, using saved meta-data whcih looks at "label" "comment" "caption" and even random user data "my_data"

How much of this is accessible in other image processors is another matter. Perhaps Glenn can tell us!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: can png file store information using IM

Post by fmw42 »

Anthony is correct. I had not realized the issue about file format. So replace the above with


convert logo: -set comment "author:testing" logo.jpg

identify logo.jpg
...

Properties:
comment: author:testing
date:create: 2011-10-31T10:45:27-07:00
date:modify: 2011-10-31T10:45:27-07:00
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
signature: 7fc87782fc1f26c79908eabc94b0382b06d3c087101fd446b333c4137af340c4
...
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: can png file store information using IM

Post by glennrp »

Most of the ancillary information that's stored in a PNG can
be accessed with
  • identify -verbose -debug coder -log %e file.png
Use Linux "grep" or something equivalent to pick out the data you want.
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: can png file store information using IM

Post by linjuming »

great help ,thank you very much
Post Reply