Browse Source

Add comments to webpanim shim

* Also for d >= 8, write output in format specifed by the extension name.
master
danblooomberg 7 days ago
parent
commit
8ccff04278
  1. 18
      prog/scaletest1.c
  2. 13
      src/webpanimio.c

18
prog/scaletest1.c

@ -30,6 +30,10 @@
* scaletest1 filein scalex scaley fileout
* where
* scalex, scaley are floating point input
*
* For d < 8 bpp, writes output in png
* For d >= 8 bpp, uses output file extension to determine output format.
*
*/
#ifdef HAVE_CONFIG_H
@ -42,7 +46,7 @@ int main(int argc,
char **argv)
{
char *filein, *fileout;
l_int32 d;
l_int32 d, fmt;
l_float32 scalex, scaley;
PIX *pixs, *pixd;
@ -75,14 +79,12 @@ PIX *pixs, *pixd;
d = pixGetDepth(pixd);
#if 1
if (d <= 8)
if (d < 8) {
pixWrite(fileout, pixd, IFF_PNG);
else
pixWrite(fileout, pixd, IFF_JFIF_JPEG);
#else
pixWrite(fileout, pixd, IFF_PNG);
#endif
} else {
fmt = getImpliedFileFormat(fileout);
pixWrite(fileout, pixd, fmt);
}
pixDestroy(&pixs);
pixDestroy(&pixd);

13
src/webpanimio.c

@ -32,6 +32,19 @@
* l_int32 pixaWriteWebPAnim()
* l_int32 pixaWriteStreamWebPAnim()
* l_int32 pixaWriteMemWebPAnim()
*
* This shim was written in 2013, shortly after Google introduced animated webp.
* However, even though animated webp is better than gifanim by every
* technical measure (e.g., flexibility, compression), animated webp
* is still not well supported, even with Google apps like gmail!
*
* To convert from gifanim to animated webp:
* (1) use ImageMagick to make a set of png files:
* convert infile.gif -coalesce outroot_%03d.png
* (2) read these files into a pixa, using
* pixaReadFiles()
* (3) write out the animated webp, selecting the duration and using
* pixaWriteWebPAnim()
* </pre>
*/

Loading…
Cancel
Save