ocaml-imagelib icon indicating copy to clipboard operation
ocaml-imagelib copied to clipboard

imagetool: Transparent frame updates

Open cfcs opened this issue 4 years ago • 1 comments

After merging https://github.com/rlepigre/ocaml-imagelib/pull/43 we now have better support for transparency in the GIF format.

The imagetool however should be updated to not paint the background color in transparent pixels in animated GIFs when they are painting on top of an opaque pixel. Basically we should replace transparent pixels in the first frame with the --background color, and after that we should probably skip the painting of transparent pixels.

The NETSCAPE extension (aka "animated GIFs") to the GIF format carries some hints like DO NOT DISPOSE that govern the semantics of whether transparent pixels should yield the previous frame content or revert to a keyframe (like the first frame) or actually be transparent in the output. This needs to be investigated and support implemented.

cfcs avatar Jan 16 '21 11:01 cfcs

NB: Imagemagick doesn't handle this case either, so will need to find an implementation that does to provide a frame of reference.

cfcs avatar Jan 16 '21 11:01 cfcs