imcodec 0.1.4 copy "imcodec: ^0.1.4" to clipboard
imcodec: ^0.1.4 copied to clipboard

Focused BMP, JPEG, PNG, QOI, TGA, TIFF, and WebP codecs for RGBA images in Flutter.

example/main.dart

import 'dart:developer';
import 'dart:typed_data';

import 'package:imcodec/imcodec.dart' as img;

/// Encodes a small RGBA image as PNG, then decodes it again.
///
/// Run this from a Flutter application, where Flutter's platform image codecs
/// are available for PNG decoding.
Future<void> main() async {
  final Uint8List rgba = Uint8List.fromList([
    255,
    0,
    0,
    255,
    0,
    255,
    0,
    255,
    0,
    0,
    255,
    255,
    255,
    255,
    255,
    128,
  ]);
  final img.Image source = img.Image.fromRgba(
    width: 2,
    height: 2,
    bytes: rgba,
  );

  final Uint8List encoded = img.encodePng(source);
  final img.Image decoded = await img.decodeImage(encoded);

  log(
    'Encoded ${source.width} × ${source.height} pixels into '
    '${encoded.lengthInBytes} PNG bytes; decoded ${decoded.width} × '
    '${decoded.height} pixels.',
    name: 'imcodec.example',
  );
}
0
likes
0
points
1.02k
downloads

Publisher

verified publisherfocale-editor.app

Weekly Downloads

Focused BMP, JPEG, PNG, QOI, TGA, TIFF, and WebP codecs for RGBA images in Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, zcodec

More

Packages that depend on imcodec