Skip to main content

Module image_prep

Module image_prep 

Source
Expand description

Images made ready to share: decoded, turned upright, fitted to a size and a byte budget, and re-encoded. Re-encoding drops every byte of metadata the original carried, camera EXIF and GPS included. Animated GIF and WebP keep their animation: they pass through when they already fit, keeping only the blocks that draw them. An animated PNG is shared as its first frame. strip does the same without re-encoding, for an image too large to.

Structs§

Prepared
A prepared image and the extension its bytes are.

Enums§

ImageUse
What the image is for, which sets its size and byte budget.

Functions§

mime_for
The MIME type for a Prepared::extension.
prepare
Make bytes ready to share as usage: upright, within its size, within its byte budget, and with no metadata. SVG is refused, as Vector never ships a foreign SVG to other people.
strip
bytes with every byte of metadata cut out and nothing re-encoded, for a picture too large to decode. None for a format this can’t strip, or one that doesn’t parse.