Overview of Sketch Decoders
mainSketch uses Decoder implementations to read data from a DataSource and decode it into images. Each supported image format has a corresponding Decoder.
Key points:
- Built-in Decoders: Decoders that do not require extra modules are automatically registered.
- Optional Modules: Decoders that depend on extra modules (e.g.,
sketch-avif-awxkee,sketch-svg) support automatic registration if the dependency is included in your project. - Manual Registration: If automatic registration is not used, you must register components manually.
| Decoder | Format | Dependent modules | Android | iOS | Desktop | Web |
|---|---|---|---|---|---|---|
| [SkiaDecoder] | jpeg, png, webp, bmp | - | ❌ | ✅ | ✅ | ✅ |
| [BitmapFactoryDecoder] | jpeg, png, webp, bmp, heif (API 27), avif (API 31) | - | ✅ | ❌ | ❌ | ❌ |
| [AwxkeeAvifDecoder] | heif (API 24), avif (API 24) | sketch-avif-awxkee | ✅ | ❌ | ❌ | ❌ |
| [PhotosAssetDecoder] | jpeg, png, webp, bmp, heif (ios 11), avif (ios 16) | - | ❌ | ✅ | ❌ | ❌ |
| [UIImageDecoder] | heif (ios 11), avif (ios 16) | - | ❌ | ✅ | ❌ | ❌ |
| [SkiaGifDecoder] | gif (no resize) | sketch-animated-gif | ❌ | ✅ | ✅ | ✅ |
| [MovieGifDecoder] | gif (no resize) | sketch-animated-gif | ✅ | ❌ | ❌ | ❌ |
| [ImageDecoderGifDecoder] | gif (API 28) | sketch-animated-gif | ✅ | ❌ | ❌ | ❌ |
| [KoralGifDecoder] | gif | sketch-animated-gif-koral | ✅ | ❌ | ❌ | ❌ |
| [ImageDecoderAnimatedWebpDecoder] | webp animated (API 28) | sketch-animated-webp | ✅ | ❌ | ❌ | ❌ |
| [SkiaAnimatedWebpDecoder] | webp animated (no resize) | sketch-animated-webp | ❌ | ✅ | ✅ | ✅ |
| [ImageDecoderAnimatedHeifDecoder] | heif animated (API 30) | sketch-animated-heif | ✅ | ❌ | ❌ | ❌ |
| [SvgDecoder] | svg (non-Android lacks CSS) | sketch-svg | ✅ | ✅ | ✅ | ✅ |
| [VideoFrameDecoder] | video frames | sketch-video | ✅ | ❌ | ❌ | ❌ |
| [FFmpegVideoFrameDecoder] | video frames | sketch-video-ffmpeg | ✅ | ❌ | ❌ | ❌ |
| [PhotosAssetVideoFrameDecoder] | video frames | sketch-video | ❌ | ✅ | ❌ | ❌ |
| [FileVideoFrameDecoder] | video frames | sketch-video | ❌ | ✅ | ❌ | ❌ |
| [BlurHashDecoder] | BlurHash | sketch-blurhash | ✅ | ✅ | ✅ | ✅ |
| [ApkIconDecoder] | Apk Icon | sketch-extensions-core | ✅ | ❌ | ❌ | ❌ |
| [DrawableDecoder] | Android res drawable | - | ✅ | ❌ | ❌ | ❌ |