Synopsis
web2png [-adnrv] [directory]…
Description
web2png is a Python 3 front end for gif2png(1). It converts GIF files under one or more web directory trees and updates references in HTML, SHTML, PHP, include, CSS, and JavaScript files. If no directory is given, the current directory is used.
By default, web2png converts only single-image GIFs. Multi-image GIFs are left unchanged because a single PNG cannot preserve their animation. A GIF is also left unchanged if a PNG with the same stem already exists.
After conversion, references in SRC, anchor HREF, and BACKGROUND
attributes and CSS url() values are changed from .gif to .png when
the referenced GIF was eligible and its PNG exists. Relative references
honor a page’s BASE HREF. Root-relative references are resolved beneath
the directory being converted.
HTTP and HTTPS references are matched to local eligible GIFs by basename. When a basename matches, web2png downloads the remote GIF and compares its contents with the local file before changing the reference.
Before changing a page that is not managed by RCS, web2png saves its
original contents in a neighboring .bak file. The first backup is retained
across repeated conversion runs. RCS-managed pages are checked out and
locked before modification.
Options
- -a
-
Convert all GIF files, including files with multiple images. References are changed to the PNG containing the first image.
- -d
-
Delete backups and GIF files that have a same-stem PNG. This operation is not automatically reversible.
- -n
-
Report the conversions that would be made without changing images or pages.
- -r
-
Reverse a conversion. Restore pages from
.bakfiles or RCS, and remove PNG files that have a same-stem GIF. - -v
-
Display additional information about file discovery and reference matching.
Caveats
web2png cannot distinguish a PNG it created from an unrelated preexisting
PNG with the same stem. The -d and -r operations should therefore be
used only after reviewing the files they will affect.
Remote matching by basename and content cannot prove that a PNG exists at the remote URL. Review rewritten remote references before deployment.
Generated or unusually formatted markup may contain references that the text-oriented scanner does not recognize. Dynamic references and CGI output must be converted separately.
See Also
gif2png(1)
Authors
Eric S. Raymond <esr@thyrsus.com>. Debian modifications by Aaron Isotton <aaron@isotton.com>.