flutter_bicubic_resize library

Fast, consistent bicubic image resizing for Flutter.

This library provides native C-based bicubic image resizing that produces identical results on iOS and Android. Uses Catmull-Rom interpolation (same as OpenCV and PIL/Pillow).

Features

  • 100% Native C performance (stb_image + stb_image_resize2)
  • Identical results on iOS and Android
  • Bicubic interpolation with multiple filter options
  • Full native pipeline: decode -> resize -> encode
  • RGB and RGBA support
  • JPEG and PNG support with alpha channel preservation

Quick Start

import 'package:flutter_bicubic_resize/flutter_bicubic_resize.dart';

// Resize JPEG
final resized = BicubicResizer.resizeJpeg(
  jpegBytes: originalBytes,
  outputWidth: 224,
  outputHeight: 224,
);

// Resize PNG
final resizedPng = BicubicResizer.resizePng(
  pngBytes: originalBytes,
  outputWidth: 224,
  outputHeight: 224,
);

Available Filters

See the API documentation for detailed usage information.

Classes

BicubicImageInfo
Image metadata obtained without full pixel decoding.
BicubicResizer

Enums

BicubicFilter
Available bicubic filter types
BicubicNativeError
Native error codes returned by the C layer.
ChannelOrder
Channel ordering for ML model input.
CropAnchor
Crop anchor positions
CropAspectRatio
Crop aspect ratio modes
EdgeMode
Edge handling modes for resize operations
ImageFormat
Supported image formats for resize operations
NormalizationType
Normalization type for ML model preprocessing.
TensorLayout
Tensor layout for ML model input.

Exceptions / Errors

BicubicResizeException
Exception thrown when a native bicubic resize operation fails.
UnsupportedImageFormatException
Exception thrown when an unsupported image format is detected.