pngtextadd - add text comments to a PNG image file
pngtextadd [--options] [filename]
pngtextadd reads a PNG image file and adds a text comment to it. A file on the command line is modified in-place
pngtextadd --keyword=Author --text=’Me Myself’ filename.png
Otherwise it reads standard input and writes standard output.
--keyword=Title --text=’A Picture’ \
Comments in PNG files consist of a "keyword" which is the type of comment, and the comment text. There are various standard keywords such as "Title", "Author" and "Copyright" but pngtextadd will add anything. The standard keywords can be found at
If your libpng is built with iTXt support then "international" text can be given (in UTF-8). --keyword is still Latin-1 but a language name and language-specific keyword (UTF-8) is possible too.
--keyword "Title" \
--lang de \
--lkeyword "Title" \
--text "Something in German" \
The idea of pngtextadd is really just to add or update comment fields in a generated image file. Many image manipulation programs have poor support for text comments and some will strip them entirely. With pngtextadd you can add back your name, a title, etc.
Each invocation only sets one comment; you can use a script or Makefile to apply multiple comments with multiple runs before publishing etc.
--keyword name, -k name
The keyword of the comment to add (Latin-1). If the keyword is already present in the file then its contents are replaced.
--text text, -t text
The text for the comment in Latin-1, or if --lang is used then in UTF-8.
--lkeyword text, -K text
A language-specific translation of the keyword, in UTF-8. This should be used in addition to the plain --keyword. (iTXt support required.)
The language code of the comment text. (iTXt support required.)
Compress the text contents if possible. For a large --text this can save some space in the file. But you might not want to compress a copyright notice or author field, so the text is still visible to a raw grep etc.
Print a brief summary of the command line options.
Print the program version, and exit.
Print some extra information. Currently all it does is add the libpng library version number to --version.
The in-place file rewrite doesn’t go through a temporary new file and consequently is not safe to an interrupt or other error. The suggestion is to backup or operate on a copy, if the image generation is entirely mechanical.
Copyright 2006, 2007, 2009, 2010, 2013, 2018 Kevin Ryde
pngtextadd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
pngtextadd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with pngtextadd; see the file COPYING. Failing that, go to http://www.gnu.org/licenses/