PhotoSauce Versions Save

MagicScaler high-performance, high-quality image processing pipeline for .NET

v0.14.2

2 months ago

This release resolves a packaging issue from v0.14.1. It contains no code changes. https://github.com/saucecontrol/PhotoSauce/issues/152

v0.14.1

2 months ago

MagicScaler v0.14.1

Important: All previous codec plugin packages are incompatible with this new release. New versions of all codec plugins are available, as detailed below. Make sure you have the "include prerelease" checkbox checked if using the NuGet Package Manager UI to update.

Fixes

  • Fixed a bug in the validation of frame ranges when using a decoder supporting IMultiFrameDecoderOptions https://github.com/saucecontrol/PhotoSauce/issues/151
  • Fixed an issue that prevented WIC codecs from decoding an image when the image did not start at the beginning of an input Stream.
  • Fixed possible incorrect DPI when mixing a WIC encoder with native plugin decoders using resolution units other than inches.

Behavioral Changes

  • Pipelines created with MagicImageProcessor.BuildPipeline no longer force conversion to sRGB by default. You can use the ColorPofileMode.ConvertToSrgb setting to force the old behavior if necessary.
  • Little-CMS is no longer used opportunistically by default on Windows. Some users were confused by DLL load failures showing up in the debugger since lcms2.dll does not ship in the package. https://github.com/saucecontrol/PhotoSauce/discussions/128
  • Referencing MagicScaler from a project using a .NET TargetFramework version that is no longer supported will now generate a warning. Because MagicScaler ships with a netstandard2.1 binary, it will still work on these platforms, but it will use non-hardware-accelerated fallback code. The warning makes it clear when this is happening and can be disabled if necessary.

Native Codec Previews

  • Improved handling of exceptions on managed <-> native transitions on Linux. Previously, an exception thrown in a managed callback from a native codec would result in a generic failure message. Now, the managed exception context is preserved, and the proper exception is thrown on return from the native code.
  • Improved handling of truncated or corrupted images in all native decoders (particularly GIF and PNG). The decoders will now decode as much of the image as they are able and will return empty pixels for the remainder. https://github.com/saucecontrol/PhotoSauce/issues/108 https://github.com/saucecontrol/PhotoSauce/issues/140
  • WebP
    • Fixed an issue that resulted in misaligned subframes in some lossy animated WebP output.
    • Fixed an issue that resulted in some pixels not clearing to fully transparent in some lossy animated WebP output.
  • HEIF
    • Updated libheif and its frame decoders (libde265 and dav1d) to the latest versions.
    • Included some additional ftyp signatures that may be found in valid HEIC/AVIF files.
    • Mitigated a possible access violation on images that decode to a different size than initially reported on header read, due to inconsistent handling of transform boxes in libheif https://github.com/strukturag/libheif/issues/1131. These cases will now return a decode error.
  • JPEG
    • Updated libjpeg-turbo to latest version.
    • Reduced managed allocations in the decoder.
  • PNG
  • GIF
    • Updated GIFLIB to latest version.
  • JPEG XL

Performance Improvements

  • Fixed a performance regression introduced by Intel's Gather Data Sampling ('Downfall') vulnerability mitigations, by disabling Gather for simple LUT mappings. With the microcode patch active, Gather performance is very significantly reduced (on the order of 4-5x slower). If you are running in an environment where mitigations are disabled, setting the PhotoSauce.MagicScaler.GdsMitigationsDisabled AppContext switch, will restore the Gather-based implementations.

API Additions

  • PlanarEncoderInfo is now public, for use in configuring defaults for JPEG and WebP encoders. https://github.com/saucecontrol/PhotoSauce/issues/133
  • Added new IIccColorProfileSource and IExifSource metadata interfaces to allow codec authors to make this metadata available to the MagicScaler pipeline.
  • Added a new TransformFactory class in the PhotoSauce.MagicScaler.Experimental namespace, which allows for advanced use of some of MagicScaler's internal transform implementations. This API was added specifically to support Paint.NET, and as the namespace implies, it is experimental and subject to change on a whim. If anyone else finds the experimental features useful, please speak up in a discussion, or risk losing them.

WebRSize v0.6.9

  • Updated to use MagicScaler v0.14.1

v0.14.0

7 months ago

MagicScaler v0.14

Notice: This release contains breaking API changes.

Breaking Changes

Fixes

Native Codec Previews

  • Updated libwebp codec package to latest version. https://github.com/saucecontrol/PhotoSauce/issues/123 ⚠ The previous version contains a critical security vulnerability ⚠
  • Updated libjpeg codec package to latest version of libjpeg-turbo.
  • Updated libpng codec package to latest version.
  • Updated libheif codec package to latest version.
  • Updated libjxl codec package to latest version.

Linux Improvements

Performance Improvements

  • Improved SIMD implementation of orientation transforms.
  • Improved speed of some pixel format conversions.

Image Quality Improvements

This release contains several color management improvements, as detailed in https://github.com/saucecontrol/PhotoSauce/issues/105

  • A true Display P3 profile is now embedded in output images when the source is in a wide-gamut format.
  • A new compact CMYK profile is now used for images without an embedded profile on both Windows and Linux, giving more consistent color conversion results.
  • Implemented gamma slope limiting, as recommended in the Adobe RGB specification.

WebRSize v0.6.8

  • Updated to use MagicScaler v0.14

v0.13.2

1 year ago

MagicScaler v0.13.2

This version marks the first release with near-complete functionality on Linux. Linux use requires registration of one or more native codecs.

Fixes

  • Fixed a bug that caused ProcessImageSettings instances to be mutated, which may have resulted in issues when using a single settings object for multiple processing operations.
  • Fixed a math error in conversions between DPI and DPC in resolution metadata.
  • Fixed dependency versioning for native codec packages when targeting downlevel frameworks #96

Cross-Platform Codec Previews

  • Added libjpeg-turbo plugin with significantly improved performance over WIC's JPEG codec and support for progressive JPEG encoding.
  • Added libpng plugin with support for APNG (decode enabled by default).
  • Added GIFLIB plugin.
  • Updated libwebp to latest version and improved animation support.
  • Updated libheif to latest version (resolves a significant performance issue https://github.com/strukturag/libheif/pull/551) and added AVIF decoding support #97.
  • Updated libjxl to latest version.

Performance Improvements

  • Improved speed of RGB<->BGR and RGBA<->BGRA conversions.

WebRSize v0.6.7

  • Updated to use MagicScaler v0.13.2

v0.13.1

1 year ago

MagicScaler v0.13.1

Fixes

  • HEIC orientation is now handled correctly when using the Windows HEIF decoder. Previously, the Exif orientation value was used, which may have resulted in double correction if the Exif value did not match the value in the HEIF header.
  • Fixed a possible PlatformNotSupportedException when running on hardware that supports AVX but not AVX2 (only very old Intel Ivy Bridge and Sandy Bridge processors had this configuration).
  • Added SupportedOSPlatform attribute to the UseWicCodecs() extension method to ensure it is only available on Windows targets.
  • Added a new .NET 7 target and included a fix to work around an issue when publishing with Native AOT using .NET 7 preview SDKs. (see https://github.com/dotnet/runtime/pull/73659)

API Changes

  • ProcessImageSettings.TrySetEncoderFormat now accepts either MIME type or file extension. Input strings starting with a . will be interpreted as file extensions, all others will be interpreted as MIME type.
  • Added ImageFileExtensions class containing constants for common image file extensions to support the above.
  • Added new members to the ChromaPosition enum to support additional subsampled chroma locations. The previous 'interstitial' and 'cosited' values have been editor hidden, and the new explicit locations should be used.

Native Codec Previews

  • Added a missing file signature to the libheif plugin. #89
  • Added a libwebp wrapper with support for lossy, lossless, and animated WebP decoding and encoding. #19
  • All native codec plugins have been updated to remove any previously-registered codecs with the same MIME type by default. For example, on Windows versions that include a WebP decoder, UseWebp() will replace the Windows WebP decoder in the pipeline in addition to registering the new encoder. If you want explicit control over registration and ordering, UseWebp(removeExisting: false) would match the old behavior.

Behavioral Changes

  • The planar pipeline is now used in more cases when decoding JPEG sources. Previously, planar processing was disabled when reading chroma-subsampled images with non-standard orientation or when specifying an explicit crop area with odd bounds. These cases are now handled correctly by the planar pipeline, so they are enabled by default.
  • When using automatic cropping, the crop is now correctly centered when working with chroma subsampled planar sources. Previously, the crop was snapped to the nearest multiple of the subsampling ratio.
  • The animated GIF encoder no longer includes the complete global palette from the source image. It now adds only the canvas background color.
  • In-codec crop and scale are now supported for non-WIC codecs. WebP is the first plugin codec to use this support.

Performance Improvements

  • Conversions to formats that are the same bit-depth or larger now always use the output buffer for intermediate processing instead of a separate intermediate buffer.
  • Conversion to and from planar video formats is now fully SIMD accelerated.
  • SIMD implementations have been improved for some common operations:
    • Codec matching by file signature.
    • Conversions from pBGRA128 to BGRA32.
    • Transposing orientation corrections.

Image Quality Improvements

  • Improved accuracy in the processing of chroma planes in the SIMD planar pipeline.

WebRSize v0.6.6

  • Updated all number parsing to use explicit Invariant culture.
  • Updated to use MagicScaler v0.13.1

v0.13.0

2 years ago

MagicScaler v0.13

Notice: This release contains breaking API changes. See the list below or the detailed change log #62 for more information.

Breaking Changes

  • Codec discovery is now internal to MagicScaler. The pipeline will find WIC codecs automatically, but the codec set and priority order may be different than seen in previous MagicScaler versions. See the change log for details and customization options.
  • The FileFormat enum has been deprecated in favor of MIME types in all APIs where it was previously used.
  • A few ProcessImageSettings properties have been deprecated in favor of codec-specific option types.
  • All MagicImageProcessor static properties that controlled global settings have been moved to either AppContext values or codec options
  • The IImageContainer and IImageFrame interfaces have changed, with some of the properties moving to the new codec integration interfaces.
  • Dropped support for netcoreapp2.1, which is now out of support by Microsoft, and net5.0 which goes out of support next month.

New APIs

  • CodecManager allows explicit configuration of encoders and decoders, along with their default codec-specific configurations.
  • Many new codec-specific option types have been added, based on the IDecoderOptions and IEncoderOptions interfaces.
  • Multiple new interfaces have been added to allow codec authors to define image decoders, encoders, metadata sources, and metadata items. #22
  • Added a new zone plate test pattern generator -- ZonePlatePixelSource.

Native Codec Previews

  • Added a libheif wrapper capable of decoding Apple HEIC images.
  • Added a libjxl wrapper to preview JPEG XL support. The underlying native library is quite unstable in this release, so use with extreme care.

Performance Improvements

  • Added new internal buffered Stream implementation to improve on the the buffering in FileStream.
  • Improved speed of palette selection and mapping for indexed color formats.
  • Improved speed of conversion from YCbCr to BGR formats.
  • Improved hybrid scaling quality and speed on BGRA images.
  • Changed buffer pool settings to match the new .NET 6 defaults.

Image Quality Improvements

  • Improved palette selection when converting high-color images to indexed formats. The new algorithm performs better on gradients by weighting color population more heavily, while the old algorithm preferred greater distance between colors, with the expectation that dithering would benefit from wider color choice.

Non-behavioral Changes

  • IL Trimming for self-contained apps is now enabled for all libraries.

WebRSize v0.6.5

  • Updated to use MagicScaler v0.13

Some default settings have changed and may result in duplicate cache images for source/size combinations. It is recommended you clear your cache when deploying the new release.

v0.12.2

2 years ago

MagicScaler v0.12.0

Fixes

  • Fixed possible corrupted output when using a custom IYccImageFrame with hybrid scaling #78

WebRSize v0.6.4

  • Updated to use MagicScaler v0.12.2

v0.12.1

3 years ago

Breaking Changes

  • Removed the previously obsoleted BuildPipeline overload that accepts ReadOnlySpan<byte>. This was meant to have been removed in the v0.12.0 release.

Fixes

  • Fixed a possible NullReferenceException when a PixelSource referenced only by a WIC component was garbage collected while still in use #69.

Behavioral Changes

  • When saving an AdobeRGB image to PNG format, a compatible V4 ICC profile will be embedded. This was the only remaining normalized color space that lacked a V4 profile.
  • IYccImageFrame sources in video YUV format are now converted correctly to full-range before output regardless of whether they pass through any other filters.

v0.12.0

3 years ago

MagicScaler v0.12.0

Breaking Changes

  • Removed netcoreapp3.0 target and replaced it with a netcoreapp3.1 target.

Fixes

  • Fixed a NotSupportedException when processing malformed animated GIFs which contain some frames larger than the Logical Screen Descriptor specifies. These frames will now be cropped to the logical screen size.
  • Fixed an ArrayPool array leak in the animated GIF encoder. (ArrayPool arrays cannot actually be leaked in the traditional memory leak sense, but they become eligible for garbage collection if not returned to the pool, negating the benefit of using the pool for those arrays.)

Performance Improvements

  • Replaced all WIC interop code with a new lightweight implementation based on TerraFX.Interop.Windows, powered by ClangSharp and the new C# 9 function pointer support. This results in a 5-10% performance gain in many cases, with larger image sources yielding larger gains due to the chatty nature of WIC interop over managed Stream implementations.
  • Added a new large buffer pool, using a custom ArrayPool instance. The new pool allows re-use of buffers between 1MiB and 16MiBs. There are few cases where MagicScaler uses buffers this large, but applications processing animated GIFs or performing orientation correction on large images may benefit. If no large buffers are required, the pool will remain empty. The pool can be disabled by setting the MagicImageProcessor.EnableLargeBufferPool property if necessary.
  • Added SIMD-accelerated implementations of transposing and horizontal flip orientation transforms.
  • Modified the SIMD convolution processors to perform better on AMD processors.

Quality Improvements

  • Improved the accuracy of palette matching when converting to an indexed color format, with a slight speed increase in most cases.

Behavioral Changes

  • When saving a PNG image that requires a wide-gamut color profile, a v4 compact profile is now embedded instead of the normal v2 profile. WIC sets the gAMA and cHRM tags along with iCCP when saving a v2 ICC profile, and Chromium-based web browsers ignore the color profile when gAMA and/or cHRM is set, resulting in incorrect display. Setting a v4 ICC profile works as expected.
  • When transcoding a wide-gamut image to GIF or BMP formats, which don't support embedding ICC profiles, the color space is now converted to sRGB by default. Previously, this was done only if ProcessImageSettings.Calculate was called before ProcessImage.
  • Added instrumentation to the indexed color converter when EnablePixelSourceStats is enabled.
  • The planar pipeline is no longer used when performing a transcode-only (no resizing) operation on a JPEG.

WebRSize v0.6.3

  • Updated to use MagicScaler v0.12.0

v0.11.2

3 years ago

MagicScaler v0.11.2

Fixes

Behavioral Changes

  • Image pixel format is now converted when using CropScaleMode.Pad and the MatteColor is not compatible with the source image format. https://github.com/saucecontrol/PhotoSauce/issues/59
  • Output GIF palettes may now be smaller when the source image has few colors. Previously all palettes were 256-color even if some weren't used.

Performance Improvements

  • Now using the new SkipLocalsInit functionality from C# 9.
  • Added more SIMD-optimized pixel format conversions.

WebRSize v0.6.2

Updated to use MagicScaler v0.11.2