native_image_compress 0.2.4 copy "native_image_compress: ^0.2.4" to clipboard
native_image_compress: ^0.2.4 copied to clipboard

Compress images to JPEG, PNG, WebP, HEIC, or AVIF using the platform's native encoders.

native_image_compress #

Compress images to JPEG, PNG, WebP, HEIC, or AVIF using the platform's native encoders.

Platform support #

Android iOS Linux macOS Web Windows
Support SDK 28+ soon soon soon soon soon
JPEG
PNG
WebP
HEIC
AVIF ⚠️

Installation #

flutter pub add native_image_compress

Android #

This plugin requires minSdk 28, raise it in android/app/build.gradle.kts:

android {
    defaultConfig {
        minSdk = 28
    }
}

AVIF support #

AVIF encoding requires the device to have an AV1 hardware or software encoder registered.

Usage #

import 'package:native_image_compress/image_compress.dart';

final jpeg = await compressToJpeg(originalBytes);
final png = await compressToPng(originalBytes);
final webp = await compressToWebp(originalBytes);
final heic = await compressToHeic(originalBytes);
final avif = await compressToAvif(originalBytes);

Quality, Crop and resize #

Every compressTo* function accepts optional quality, cropOptions and resizeOptions:

final result = await compressToJpeg(
  originalBytes,
  quality: 80,
  cropOptions: CropOptions(x: 0, y: 0, width: 800, height: 600),
  resizeOptions: ResizeOptions(maxWidth: 1080, maxHeight: 1080),
);
1
likes
0
points
439
downloads

Publisher

verified publishernexosphere.xyz

Weekly Downloads

Compress images to JPEG, PNG, WebP, HEIC, or AVIF using the platform's native encoders.

Repository
View/report issues

Topics

#image #compress #webp #heic #avif

License

unknown (license)

Dependencies

flutter, meta, plugin_platform_interface

More

Packages that depend on native_image_compress

Packages that implement native_image_compress