1png(n)                        Image manipulation                        png(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       png - PNG querying and manipulation of meta data
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require crc32
14
15       package require png  ?0.1.1?
16
17       ::png::validate file
18
19       ::png::isPNG file
20
21       ::png::imageInfo file
22
23       ::png::getTimestamp file
24
25       ::png::setTimestamp file time
26
27       ::png::getComments file
28
29       ::png::removeComments file
30
31       ::png::addComment file keyword text
32
33       ::png::addComment file keyword lang keyword2 text
34
35_________________________________________________________________
36

DESCRIPTION

38       This  package  provides  commands  to  query and modify PNG images. PNG
39       stands  for   Portable   Network   Graphics   and   is   specified   at
40       http://www.libpng.org/pub/png/spec/1.2.
41

COMMANDS

43       ::png::validate file
44              Returns a value indicating if file is a valid PNG file. The file
45              is checked for PNG signature, each chunks checksum is  verified,
46              existence  of  a  data chunk is verified, first chunk is checked
47              for header, last chunk is checked for ending. Things not checked
48              for  are:  validity  of  values  within a chunk, multiple header
49              chunks, noncontiguous data chunks, end chunk before actual  eof.
50              This procedure can take lots of time.
51
52              Possible return values:
53
54              OK     File is a valid PNG file.
55
56              SIG    no/broken PNG signature.
57
58              BADLEN corrupt chunk length.
59
60              EOF    premature end of file.
61
62              NOHDR  missing header chunk.
63
64              CKSUM  crc mismatch.
65
66              NODATA missing data chunk(s).
67
68              NOEND  missing end marker.
69
70       ::png::isPNG file
71              Returns  a boolean value indicating if the file file starts with
72              a PNG signature. This is a much faster and less intensive  check
73              than  ::png::validate  as  it  does not check if the PNG data is
74              valid.
75
76       ::png::imageInfo file
77              Returns a dictionary with keys width, height, depth, color, com‐
78              pression,  filter,  and interlace. The values are the associated
79              properties of the PNG image in file.  Throws an error if file is
80              not  a  PNG  image, or if the checksum of the header is invalid.
81              For information on interpreting  the  values  for  the  returned
82              properties    see    http://www.libpng.org/pub/png/spec/1.2/PNG-
83              Chunks.html.
84
85       ::png::getTimestamp file
86              Returns the epoch time if a timestamp chunk is found in the  PNG
87              image contained in the file, otherwise returns the empty string.
88              Does not attempt to verify the checksum of the timestamp  chunk.
89              Throws an error if the file is not a valid PNG image.
90
91       ::png::setTimestamp file time
92              Writes  a  new  timestamp  to the file, either replacing the old
93              timestamp, or adding one just before the data  chunks  if  there
94              was no previous timestamp. time is the new time in the gmt epoch
95              format.  Throws an error if file is not a valid PNG image.
96
97       ::png::getComments file
98              Currently supports only uncompressed comments. Does not  attempt
99              to  verify  the  checksums of the comment chunks. Returns a list
100              where each element is a comment. Each comment is itself a  list.
101              The  list  for  a plain text comment consists of 2 elements: the
102              human readable keyword, and the text data. A  unicode  (interna‐
103              tional)  comment consists of 4 elements: the human readable key‐
104              word, the language identifier, the translated keyword,  and  the
105              unicode  text  data.  Throws an error if file is not a valid PNG
106              image.
107
108       ::png::removeComments file
109              Removes all comments from the PNG image in file. Beware  -  This
110              uses  memory  equal to the file size minus comments, to hold the
111              intermediate result.  Throws an error if file is not a valid PNG
112              image.
113
114       ::png::addComment file keyword text
115              Adds  a plain text comment to the PNG image in file, just before
116              the first data chunk. Will throw an error if no  data  chunk  is
117              found. keyword has to be less than 80 characters long to conform
118              to the PNG specification.
119
120       ::png::addComment file keyword lang keyword2 text
121              Adds a unicode (international) comment to the PNG image in file,
122              just before the first data chunk. Will throw an error if no data
123              chunk is found. keyword has to be less than 80  characters  long
124              to  conform to the PNG specification. keyword2 is the translated
125              keyword, in the language specified by  the  language  identifier
126              lang.
127

KEYWORDS

129       comment, image, png, timestamp
130
132       Copyright (c) 2004, Code: Aaron Faupell <afaupell@users.sourceforge.net>
133       Copyright (c) 2004, Doc:  Andreas Kupries <andreas_kupries@users.sourceforge.net>
134
135
136
137
138png                                  0.1.1                              png(n)
Impressum