jpegtran_ffi 0.0.4

Flutter Android iOS

Mostly lossless transformations of JPEG images, implemented using libjpeg-turbo via Dart's FFI.

jpegtran_ffi #

Mostly lossless transformations for JPEG images, implemented using libjpeg-turbo via Dart's FFI.

Example #

void _cropToSquareRotate() {
    var jpegtran = JpegTransformer(_imageBytes);
    try {
        var info = jpegtran.getInfo();

        var cropSize = min(info.width, info.height);
        var crop = JpegCrop(
            w: cropSize,
            h: cropSize,
            x: (info.width - cropSize) ~/ 2,
            y: (info.height - cropSize) ~/ 2,
            alignIfRequired: true,
        );

        var rotate = JpegRotation(
            angle: 90,
            crop: crop,
            options: JpegOptions(grayscale: false),
        );

        var newImage = jpegtran.transform(rotate);
        setState(() {
            _imageBytes = newImage;
        });
    } catch (err) {
        _showError(err, context);
    } finally {
        jpegtran.dispose();
    }
}

TODO #

  • Remove unneeded parts of libjpeg-turbo
1
likes
90
pub points
24%
popularity

Mostly lossless transformations of JPEG images, implemented using libjpeg-turbo via Dart's FFI.

Homepage

Documentation

API reference

Uploader

eug48.github@gmail.com

License

unknown (LICENSE)

Dependencies

ffi, flutter

More

Packages that depend on jpegtran_ffi