{"record":{"id":"b0cc198e8abcdb01","repo":"d2phap/ImageGlass","slug":"ige-unsupported-image-format-b0cc19","errorCode":null,"errorMessage":"IGE: Unsupported image format.","messagePattern":"IGE: Unsupported image format\\.","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"source/ImageGlass.Lib/Common/Photoing/Codecs/SkiaCodecs/SkiaCodec.cs","lineNumber":401,"sourceCode":"            // 1. apply transforms\n            using var transformedImg = TransformImage(srcImg, transform);\n            var dstImg = transformedImg ?? srcImg;\n            if (dstImg.IsDisposed() || token.IsCancellationRequested) return;\n\n\n            // 2. use Magick to save\n            if (MagickCodec.CanWrite(destFilePath))\n            {\n                using var imgM = ToMagick(dstImg);\n                if (imgM is null) return;\n\n                // write image data to file\n                imgM.Quality = quality;\n                await imgM.WriteAsync(destFilePath, token);\n            }\n            else\n            {\n                throw new FormatException(\"IGE: Unsupported image format.\");\n            }\n\n        }\n        catch (OperationCanceledException) { }\n    }\n\n\n    /// <summary>\n    /// Checks if the photo can be pinged to get metadata.\n    /// </summary>\n    public static bool CanPing(string srcFilePath)\n    {\n        using var codec = SKCodec.Create(srcFilePath);\n        if (codec.IsDisposed()) return false;\n\n        return true;\n    }\n","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/d2phap/ImageGlass/blob/4a3c4feceffc5a8bb5e56ba836509634aaae47a9/source/ImageGlass.Lib/Common/Photoing/Codecs/SkiaCodecs/SkiaCodec.cs#L383-L419","documentation":"Thrown by SkiaCodec.SaveAsync when the destination extension is not writable by Magick.NET. SkiaCodec has no native encoder of its own; it delegates writing to MagickCodec.CanWrite, and if that returns false it throws FormatException. Same root cause as the MagickCodec.SaveAsync error, but on the Skia save entry point.","triggerScenarios":"Calling SkiaCodec.SaveAsync with a destination extension Magick.NET cannot write: unknown extension, extension without an encoder in the loaded native asset, or a missing extension.","commonSituations":"Saving a Skia-decoded image (the fast path) to a format only a plugin or a fuller Magick build can write; HEIC/AVIF save on a build without the encoder; typo in the destination extension.","solutions":["Call MagickCodec.CanWrite(destFilePath) before SkiaCodec.SaveAsync and remap to a supported extension.","Restrict the Save As dialog to extensions known to be writable (.png, .jpg, .tif, .bmp, .gif, .webp).","Ship the Magick.NET native asset that includes the required encoder for the runtime.","If a plugin owns the extension, route through CodecEncodePipeline instead of SkiaCodec.SaveAsync directly."],"exampleFix":"// before\nawait SkiaCodec.SaveAsync(srcImg, destFilePath, transform, quality, token);\n\n// after\nif (!MagickCodec.CanWrite(destFilePath))\n{\n    destFilePath = Path.ChangeExtension(destFilePath, \".png\");\n}\nawait SkiaCodec.SaveAsync(srcImg, destFilePath, transform, quality, token);","handlingStrategy":"validation","validationCode":"if (!MagickCodec.CanWrite(destFilePath))\n    destFilePath = Path.ChangeExtension(destFilePath, \".png\");","typeGuard":null,"tryCatchPattern":"try { await SkiaCodec.SaveAsync(srcImg, destFilePath, transform, quality, token); }\ncatch (FormatException ex) when (ex.Message.Contains(\"Unsupported image format\"))\n{ destFilePath = Path.ChangeExtension(destFilePath, \".png\"); /* retry */ }","preventionTips":["Restrict Save As targets to extensions MagickCodec.CanWrite accepts.","Route plugin-owned extensions through CodecEncodePipeline, not SkiaCodec.SaveAsync directly.","Ensure the Magick.NET native asset for the runtime includes the encoder you need."],"tags":["codec","skia","save","format","encode"],"backgroundTag":null,"analyzedSha":"4a3c4feceffc5a8bb5e56ba836509634aaae47a9","analyzedAt":"2026-08-13T16:58:15.523Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}