ComputeSharp icon indicating copy to clipboard operation
ComputeSharp copied to clipboard

Support saving textures to non-built in ContainerFormats

Open elyoh opened this issue 1 year ago • 0 comments

Rationale

WIC is extensible and allows users to register other ContainerFormats for use. Today, if a user has installed the HEIF Image Extensions from the Microsoft Store, they can load an image in that format by passing a FileStream to the texture.

During save, the output format is either determined from the file extension (see #799) or the provided ImageFormat. Only built in ContainerFormats can be used.

Proposed API

The proposed API would allow users to specify the output format using a ContainerFormat provided in the form of a Guid instead.

Drawbacks

Unknown.

Alternatives

Unknown.

Other thoughts

In .NET WPF, a custom WIC encoder can be constructed from the ContainerFormat Guid. For example using BitmapEncoder.Create(new("E1E62521-6787-405B-A339-500715B5763F")) hooks up the HEIF Image Extensions from the Microsoft Store and allows users to save images in this format. Note this only works on later .NET and not in the .NET Framework due to a bug (https://github.com/dotnet/wpf/issues/6344).

elyoh avatar May 31 '24 18:05 elyoh