strredwolf: (ByPatches)
STrRedWolf ([personal profile] strredwolf) wrote2004-06-13 10:27 pm

The comic compiler, retro style.

Okay, these image libraries suck:

Imagemagick (because it doesn't optimize PNG's right)
GD (because it has no "downgrade to 16 greys" functionality)

So I rewrite the comic compiler again... and find that Slackware's NetPBM utilities date back to 1998.  Okay, update that, and recheck the docs...

...and gut the recompiler.  90% of the pixel-pushing, including worrying about placement, NetPBM handles already.  I could rewrite it in bash.

ImageMagic origonal version:  142 lines of code.
GD version (PNG output): 116 lines of code.
ImageMagic PNG output: 87 lines of code

NetPBM version:  69 lines of code
"does nothing" base (for comparison): 49 lines.

I wonder what the bash version would be like.

[identity profile] kisai.livejournal.com 2004-06-13 08:32 pm (UTC)(link)
use pngcrush

Re: PNGCrush

[identity profile] strredwolf.livejournal.com 2004-06-13 09:28 pm (UTC)(link)
Just compiled it (with the bundled libs). And it's doing "no change" or under 1% reduction on the post-compiled files... the same as to what I was doing with GD, but not ImageMagic.

You have to remember, the compiler is doing this on each comic:

1. Taking the 300 dpi image, and shrinking it down to 72-75 DPI.
2. Slapping the header up top of it, and the comic below.
3. Saving the result to JPEG or 16-grey PNG.