image_ffi 0.4.2
image_ffi: ^0.4.2 copied to clipboard
Fast native image resize, thumbnail and JPEG/PNG encode for Dart over FFI. Several times quicker than the pure-Dart image package; stb-backed, no prebuilt binary.
0.4.2 #
example/no_jank.dartmeasures what the async variants are for. It builds a 4000x3000 JPEG so no file is needed, makes eight thumbnails on the main isolate and eight withthumbnailJpegAsync, and runs a 16 ms timer alongside to report the longest gap between two ticks. On this machine: 413 ms of silence, about 25 frames, against 18 ms and one. The work takes the same time either way, which is the point; what moves is where it happens.example/README.mdsays which call to reach for and why the thumbnail functions exist at all, given the three-step version crosses the FFI boundary three times and holds the full-size pixel buffer in Dart in between.
0.4.1 #
- Declare the benchmark chart in
pubspec.yamlso pub.dev renders it on the package page. The chart was already in the repository and the README, but pub.dev shows only what thescreenshots:field points at, so the page a reader lands on from search opened with text where the measurement should have been.
0.4.0 #
- Add
thumbnailJpegAsyncandthumbnailPngAsync. They take the same arguments as the synchronous versions and return aFuture, running the whole decode, resize and encode on a background isolate withIsolate.runso a large image doesn't block the calling isolate. In a Flutter app this keeps the UI responsive while a picked photo is turned into a thumbnail, which neither the pure-Dartimagepackage nor a synchronous FFI call can do on the main isolate. AnImageFfiExceptionraised in the worker surfaces from the future.
0.3.0 #
- Add
thumbnailPng, a one-call decode, resize, and PNG encode that keeps the alpha channel. Reach for it on logos, icons, screenshots, and anything with transparency, wherethumbnailJpegwould flatten the transparent areas onto a background.
0.2.1 #
- Docs: sharpen the pub.dev description to lead with the value and the terms people search.
0.2.0 #
resizePixelsnow takes acolorSpace(ResizeColorSpace.srgbby default, or.linear). sRGB is right for photographic and UI images; linear is for masks and data pixels where an sRGB curve would distort the values.- Fix: 2-channel input is now resampled as grayscale + alpha (STBIR_RA) instead of two colour channels, so edges against transparency stay clean for gray+alpha images. Previously a 2-channel resize let transparent pixels bleed into the colour.
0.1.0 #
- Initial release.
- Decode PNG, JPEG, BMP, GIF, PSD, TGA, HDR and PIC from memory
(
decodeImage), with an optional forced channel count. - Read dimensions and channel count without decoding pixels (
imageInfo). - High-quality, sRGB-correct resize (
resizePixels). - JPEG and PNG encoding to memory (
encodeJpeg,encodePng). - One-call thumbnail generation (
thumbnailJpeg): decode, aspect-preserving downscale and JPEG encode. - Native stb sources compiled from source by a Dart build hook; no prebuilt binaries.