Wikivoyage:Comments in image files
The two image file formats most important for us, JPEG and PNG, both can contain comments. If you are trying to find the copyright holder of some image you may be lucky enough to find some hint in the image file's comment. Many image processing programs are able to show them.
Reading the Comment
[edit]On Windows
[edit]On Mac
[edit]On Linux
[edit]Open a shell and type
jpegtopnm -comments image1.jpeg > /dev/null
The comment of the image file image1.jpeg is written to standard error. In order to find the comment of a PNG file, type
pngtopnm -text commentfile image1.png > /dev/null
The comment is written into the file commentfile.
To read comments added in a jpeg file, use the command line tool rdjpgcom.
rdjpgcom -verbose image_with_comment.jpeg
Writing a Comment
[edit]On Windows
[edit]for testing only
On Mac
[edit]On Linux
[edit]PPM file to JPEG file
[edit]Open a shell and type
pnmtojpeg -comment "Author: Emma Peel; Licence: Attribution-ShareAlike 1.0" image1.ppm > image1.jpeg
Thus, the new JPEG file image1.jpeg with the above comment is created from the PPM file image1.ppm.
PPM file to PNG file
[edit]In order to create a PNG file with comment you first need to create a comment file in the format
Key1 Value1 Key2 Value2 Key3 Value3 . .
Assumed we had a file called comment-file with the following contece:
#>cat comment-file Author: Emma Peel Licence: Attribution-ShareAlike 1.0 #>
we create the new PNG file by typing
pnmtopng -text comment-file image1.ppm > image1.png
Add comment to existing JPEG files
[edit]The command line tool 'wrjpgcom' can be used to add comments to existing JPEG files.
Open a shell and type
wrjpgcom -comment "Author: Emma Peel; Licence: Attribution-ShareAlike 1.0" image1.jpeg > image_with_comment.jpeg
If there is an existing comment block (even an empty one) in the JPEG file, you must add the option '-replace' for this to work:
wrjpgcom -replace -comment "Author: Emma Peel; Licence: Attribution-ShareAlike 1.0" image1.jpeg > image_with_comment.jpeg
Please refer to the man page for more details.