d2phap/ImageGlass · error · FileFormatException

IGE_001

IGE_001

Error message

IGE_001: Unsupported image format.

What it means

Thrown by PhotoCodec.SaveAsync (v9) when CheckSupportFormatForSaving(destFilePath) returns false. That helper delegates to MagickFormatInfo.Create(destFilePath).SupportsWriting, i.e. Magick.NET decides from the destination file extension whether it can encode that format. If the extension is unknown, unregistered, or a read-only/decompress-only format for Magick.NET, SaveAsync throws FileFormatException. The error code IGE_001 is ImageGlass's internal identifier for 'cannot write this image format'.

Source

Thrown at v9/Components/ImageGlass.Base/Photoing/Codecs/PhotoCodec.cs:455

    /// <summary>
    /// Save as image file, use Magick.NET.
    /// </summary>
    /// <param name="srcFileName">Source filename to save</param>
    /// <param name="destFilePath">Destination filename</param>
    /// <param name="readOptions">Options for reading image file</param>
    /// <param name="transform">Changes for writing image file</param>
    /// <param name="quality">Quality</param>
    /// <exception cref="FileFormatException"></exception>
    public static async Task SaveAsync(string srcFileName, string destFilePath, CodecReadOptions readOptions, ImgTransform? transform = null, uint quality = 100, CancellationToken token = default)
    {
        var ext = Path.GetExtension(destFilePath).ToUpperInvariant();

        try
        {
            if (!CheckSupportFormatForSaving(destFilePath))
            {
                throw new FileFormatException("IGE_001: Unsupported image format.");
            }

            var settings = ParseSettings(readOptions, true, srcFileName);


            using var imgData = await ReadMagickImageAsync(
                srcFileName,
                Path.GetExtension(srcFileName),
                settings,
                readOptions with
                {
                    // Magick.NET auto-corrects the rotation when saving,
                    // so we don't need to correct it manually.
                    CorrectRotation = false,
                }, transform, token);

            if (imgData.MultiFrameImage != null)
            {

View on GitHub (pinned to 4a3c4fecef)

Solutions

  1. Verify the destination extension is in Magick.NET's writable set before calling (see validationCode) and restrict the Save-As picker to those extensions.
  2. Install/enable the Magick.NET delegate (e.g. HEIC/AVIF/AOM) appropriate for the format, or switch to a Magick.NET build that includes it.
  3. Fall back to a known-good writable format (PNG/JPEG) when the requested one is unsupported.
  4. Catch FileFormatException at the call site and show the user which extension was rejected.

Example fix

// before
await PhotoCodec.SaveAsync(src, destPath, readOpts);

// after: gate on SupportsWriting
var info = MagickFormatInfo.Create(destPath);
if (info is null || !info.SupportsWriting)
    throw new InvalidOperationException($"Cannot save to '{destPath}': format not writable by Magick.NET.");
await PhotoCodec.SaveAsync(src, destPath, readOpts);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm Magick.NET can write the destination extension before saving.
var fmt = MagickFormatInfo.Create(destFilePath);
if (fmt is null || !fmt.SupportsWriting)
    throw new InvalidOperationException($"Format not writable: {Path.GetExtension(destFilePath)}");

Try / catch

try { await PhotoCodec.SaveAsync(src, destPath, readOpts); }
catch (FileFormatException ex) when (ex.Message.Contains("IGE_001"))
{ /* destination format not writable by Magick.NET */ }

Prevention

When it happens

Trigger: Saving to a destination whose extension Magick.NET cannot write — e.g. '.heic', '.avif' (without the right Magick build), '.cr2', '.tiff' variants not enabled, or a typo'd/unknown extension; calling SaveAsync after changing the Save-As extension to something Magick.NET's SupportsWriting reports false for.

Common situations: User picks an obscure or raw-camera format in Save As; the Magick.NET package in use lacks the codec delegates for that format; a custom extension mapping points to a non-writable MagickFormat; building ImageGlass without the full Magick.NET native deps.

Related errors


AI-assisted analysis of d2phap/ImageGlass@4a3c4fecef (2026-08-13). Data as JSON: /api/errors/3cf2f29ffc523165. Report an issue: GitHub.