SetPNG: Difference between revisions

From ZDoom Wiki
Jump to navigation Jump to search
m (gra)
m (grAb. Lower case b. lower case g for non-critical. lower case r for non-standard. upper-case A 'cuz third letter is always uppercase. lower case b because it should be kept. grAb. grAb. grAb.)
Line 7: Line 7:
:Remove alPh chunk from source file.
:Remove alPh chunk from source file.
;-grab <x> <y>
;-grab <x> <y>
:Set contents of [[grAB]] chunk in output file.
:Set contents of [[grAb]] chunk in output file.
;-z
;-z
:Recompress IDAT chunks. If you saved the PNG with an older version of Photoshop, you might want to do this, because Photoshop used to do a very poor job of compressing PNG files. However, using [http://www.advsys.net/ken/utils.htm PNGOut] with the /k1 option will produce even better compression.
:Recompress IDAT chunks. If you saved the PNG with an older version of Photoshop, you might want to do this, because Photoshop used to do a very poor job of compressing PNG files. However, using [http://www.advsys.net/ken/utils.htm PNGOut] with the /k1 option will produce even better compression.

Revision as of 22:06, 30 June 2008

SetPNG is a little command-line tool written by Randy Heit which can be used to set sprite offsets in PNG files and create alpha map decals. While people may prefer the more intuitive graphical interface of SLumpEd which can do the same thing and much more, SetPNG can be used in batch scripts (.bat files) to perform this operation automatically on a large number of sprites.

Options

-alph
Create alPh chunk in output file.
-noalph
Remove alPh chunk from source file.
-grab <x> <y>
Set contents of grAb chunk in output file.
-z
Recompress IDAT chunks. If you saved the PNG with an older version of Photoshop, you might want to do this, because Photoshop used to do a very poor job of compressing PNG files. However, using PNGOut with the /k1 option will produce even better compression.

Chunks

PNG chunks can be likened to WAD lumps, they are a specific subpart of the file. Contrarily to lumps, they are case-sensitive: The first letter is upper-case for "critical" chunks (without which the image cannot work) and lower-case for "ancillary" chunks (which can be ignored). The second letter is upper case for public chunks (part of the standard specifications) or lower case for "private" chunks (non-standard, which is the case here for the alPh and grAb chunks). The third letter has no given role yet and is thus always upper case, and the last letter indicates whether image manipulation software that does not recognize the chunk should delete it (upper-case) or keep it (lower-case).

IDAT
IDAT chunks contain the image data proper.
grAb
The grAb chunk contains the sprite's X and Y offsets, setting them is presumably the main reason for using SetPNG.
alPh
The alPh chunk is used to indicate that a grayscale image is actually an alpha map, and is primarily intended for use with decals. This chunk was created because the PNG specification has no standardized way for storing alpha channels without image data.

Download link 1 / Download link 2