Skip to main content

Module webp_convert

Module webp_convert 

Source
Expand description

Converting WebP items to PNG or JPG (Eagle’s Convert WebP, offered in the item menu when the item is a WebP).

What Eagle does, which falcon follows: animated WebPs are skipped; the picture is decoded and written as PNG, or as JPG at full quality, under the item’s name with the new extension; the WebP goes; the item takes the new extension and file size. Its thumbnail stays, except that an image no larger than NO_THUMBNAIL_SIZE on both sides loses its thumbnail and shows its original instead. Dimensions, palette, tags and everything else stay.

falcon differs in three ways. The new file is written next to the old one under a temporary name, flushed, and swapped in only once complete; if saving the item fails, the old file comes back. The old WebP is not deleted but handed to the caller’s discard (the app moves it to the Trash), so a conversion can be undone by hand. And a transparent WebP converted to JPG is laid on white (Eagle’s canvas turns transparency black). The undo step is marked irreversible, as for other edits that rewrite the original.

Enums§

Converted
What converting one item did.
Format
The formats Eagle converts WebP to.

Functions§

encode
Encodes img in format: PNG as decoded, JPG at quality 100 with any transparency laid on white.
is_animated
Whether WebP bytes hold an animation (an ANMF frame chunk), as Eagle tests it.