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
- BicubicFilter.catmullRom - Default. Same as OpenCV/PIL. Best for ML.
- BicubicFilter.cubicBSpline - Smoother, more blurry.
- BicubicFilter.mitchell - Balanced between sharp and smooth.
See the API documentation for detailed usage information.
Classes
Enums
- BicubicFilter
- Available bicubic filter types
- CropAnchor
- Crop anchor positions
- CropAspectRatio
- Crop aspect ratio modes
- EdgeMode
- Edge handling modes for resize operations
- ImageFormat
- Supported image formats for resize operations
Exceptions / Errors
- UnsupportedImageFormatException
- Exception thrown when an unsupported image format is detected.