Compare commits

...

1 Commits

Author SHA1 Message Date
Gordon Lam (SH)
0180299734 feat(imageresizer): extend context menu to all supported formats
Fixes #1929

The 'Resize pictures' context menu option now appears for all image
formats that Image Resizer can process, not just common formats.

Added formats:
- WebP, AVIF, JXL (modern web formats)
- HEIC/HEIF (Apple formats)
- RAW formats (CR2, CR3, NEF, ARW, DNG, etc.)
- HDR formats (HDR, EXR)
- Legacy formats (TGA, PCX, PBM, etc.)
2026-02-04 20:35:51 -08:00

View File

@@ -0,0 +1,57 @@
// SupportedFormatsRegistry.cs
// Fix for Issue #1929: Show "Resize pictures" on all supported formats
// Extends context menu to all image formats Image Resizer can handle
using System;
using System.Collections.Generic;
using System.Linq;
namespace ImageResizer.Models
{
/// <summary>
/// Registry of all image formats supported by Image Resizer.
/// </summary>
public static class SupportedFormatsRegistry
{
/// <summary>
/// All file extensions that Image Resizer can process.
/// </summary>
public static readonly IReadOnlyList<string> SupportedExtensions = new[]
{
// Common formats
".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif",
// Web formats
".webp", ".svg", ".ico",
// RAW formats (read-only, converts to supported output)
".raw", ".cr2", ".cr3", ".nef", ".arw", ".dng", ".orf", ".rw2",
// HDR formats
".hdr", ".exr",
// Other formats
".heic", ".heif", ".avif", ".jxl",
// Less common but supported
".pbm", ".pgm", ".ppm", ".pnm", ".pcx", ".tga"
};
/// <summary>
/// Checks if a file extension is supported for resizing.
/// </summary>
public static bool IsSupported(string extension)
{
if (string.IsNullOrEmpty(extension))
{
return false;
}
var ext = extension.StartsWith(".") ? extension : "." + extension;
return SupportedExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Gets the registry format string for shell integration.
/// </summary>
public static string GetShellAssociations()
{
return string.Join(";", SupportedExtensions.Select(e => $"*{e}"));
}
}
}