heic_to_png_jpg 0.1.0
heic_to_png_jpg: ^0.1.0 copied to clipboard
A Flutter package to convert HEIC images to JPG, PNG, or WebP on mobile, web, and desktop platforms.
Changelog #
0.1.0 - 2026-03-21 #
Added #
- WebP output format — new
ImageFormat.webpvalue andHeicConverter.convertToWebP()convenience method. Web uses native canvasimage/webp; mobile falls back to PNG (theimagepackage has no WebP encoder). maxHeightparameter on all conversion methods. When bothmaxWidthandmaxHeightare set, images are scaled to fit within the bounding box (contain mode) while preserving aspect ratio.HeicConverter.isHeic()— pure-Dart magic-byte check; no decode needed.HeicConverter.getImageInfo()— returnsHeicImageInfo(width, height) by decoding in an isolate.HeicConverter.convertToWebP()— convenience wrapper for WebP output.HeicConverter.convertBatch()— converts a list ofHeicConversionTaskobjects concurrently with a configurableconcurrencylimit (default 3).HeicConverter.convertFile()— file-path based API (mobile/desktop only); reads from disk, writes result back, returns output path.- Custom exception hierarchy —
HeicConversionException,InvalidHeicDataException,ConversionFailedException,PlatformNotSupportedException. HeicImageInfoclass — holdswidthandheightof a HEIC image.HeicConversionTaskclass — describes a single job forconvertBatch().- Desktop platform support — added
macos,windows,linuxtopubspec.yamlplatforms block (existing Dart fallback handles them). - Unit tests — 20 tests covering
isHeic, enum values, exception hierarchy, and data classes. topicsin pubspec.yaml for better pub.dev discoverability (image,heic,heif,converter).
Fixed #
- Temp file name collision — temp files now use a microsecond timestamp (
heic_<id>.heic) instead of the hardcodedtemp.heic, preventing corruption when multiple conversions run concurrently. - Temp file cleanup on error — a
finally-style delete ensures the input.heictemp file is removed even whenheif_converterthrows. - Debug
log()calls removed — alldart:developerlog()calls have been removed fromheic_to_png_jpg_web.dart. - Quality parameter validation — values outside 0–100 now throw
InvalidHeicDataExceptioninstead of being silently passed to encoders.
Changed #
- Lazy platform singleton —
HeicToImagePlatformis now instantiated once (lazy singleton) instead of on everyconvertToImage()call. drawImageScaledreplaced withdrawImage(the former was deprecated inpackage:web).- Barrel file now exports
HeicConversionException,InvalidHeicDataException,ConversionFailedException,PlatformNotSupportedException,HeicImageInfo, andHeicConversionTask. - Version bump to
0.1.0.
0.0.6 - 2024-12-23 #
Changed #
- BREAKING: Default quality increased from 80 to 100 for maximum quality output
- Quality parameter now applies correctly even when
maxWidthis not specified - Optimized conversion process to avoid unnecessary re-encoding when quality is 100% (default)
Fixed #
- Fixed issue where quality parameter was only applied during image resizing
- Fixed quality not being respected when converting without resizing
- Improved image quality preservation in all conversion scenarios
Improved #
- Better performance: Skip re-encoding when using default quality (100%) and no resizing
- More efficient memory usage by avoiding decode/encode cycles when not needed
- Enhanced quality control consistency across different conversion paths
Technical Details #
- Added smart processing detection: only re-encodes when quality < 100 or resizing is needed
- Maintained backward compatibility with existing API
- Quality parameter now works as expected in all scenarios:
- Converting without resizing (previously ignored)
- Converting with resizing (previously worked)
- Converting with custom quality settings
0.0.5 #
- Moved web implementation to
package:webanddart:js_interopto support wasm compilations. - The plugin handles loading the
libheif-bundle.jsitself, no longer do you need to add it manually to your index.html. - You can provide a different libheif js version in the convertors e.g.
final output = await HeicConverter.convertToPNG(
heicData: heicData,
maxWidth: maxWidth,
libheifJsUrl:'https://cdn.jsdelivr.net/npm/libheif-js@1.19.8/libheif-wasm/libheif-bundle.js',
);
0.0.4 #
- fixed the web support bug.
0.0.3 #
- fixed the web support bug.
0.0.2 #
- Fixed "No implementation found for this platform" error by removing default
HeicToImageImplementationand ensuring explicit platform instantiation.
0.0.1 #
- Initial release of
heic_to_png_jpg. - Supports HEIC to PNG and JPG conversion on web (via libheif-js) and mobile (via heif_converter).
- Includes platform interface for extensibility.