View Source ThumbHash (ThumbHash v0.2.1)
A bridge to the Rust ThumbHash library. See: https://github.com/evanw/thumbhash for original implementation.
Note: a Rust toolchain is required to compile the rust deps.
Summary
Functions
Generates a base64 encoded thumbhash of the image located at path
Generates a base64 encoded thumbhash of the image stored in thumbnail
Generates a base64-encoded, inline representation of an image from a
base64-encoded hash
in the given format
(default: ".png"
)
Generates an image from a base64-encoded hash
Takes rgba data as a binary in u8 rgba format flattened with 4 values per pixel. e.g. <<r1 g1 b1 a1 r2 g2 b2 a2 ...>> Returns a list of integer values that make up a thumbhash of the image Images must be pre-scaled to fit within a 100px x 100px bounding box.
Takes a hash as a binary and returns the width, height, and image data.
Functions
Generates a base64 encoded thumbhash of the image located at path
Generates a base64 encoded thumbhash of the image stored in thumbnail
Generates a base64-encoded, inline representation of an image from a
base64-encoded hash
in the given format
(default: ".png"
)
@spec generate_image!(binary()) :: Vix.Vips.Image.t() | no_return()
Generates an image from a base64-encoded hash
@spec rgba_to_thumb_hash(non_neg_integer(), non_neg_integer(), binary()) :: [byte()] | no_return()
Takes rgba data as a binary in u8 rgba format flattened with 4 values per pixel. e.g. <<r1 g1 b1 a1 r2 g2 b2 a2 ...>> Returns a list of integer values that make up a thumbhash of the image Images must be pre-scaled to fit within a 100px x 100px bounding box.
@spec thumb_hash_to_rgba([byte()]) :: {:ok, {non_neg_integer(), non_neg_integer(), binary()}} | {:error, any()} | no_return()
Takes a hash as a binary and returns the width, height, and image data.