Open PhMajerus opened 4 years ago
@crutkas Unfortunately, no, that one seems to be only designed to enable SVG in XAML UI elements, while WIC is the interface for Win32 COM-based Windows image codecs to encode, decode, access metadata, and the foundation to read and write images for many 3rd party software. https://docs.microsoft.com/en-us/windows/win32/wic/
The benefit of WIC is that Win32 apps can simply request the appropriate codec for a file and WIC will find a decoder for it, making it possible for features such as "Insert image" or "Import image" to be extended with Microsoft-provided or 3rd party image formats, this is how MS Paint can now open HEIC and WebP images. For example, Microsoft provides the following installable codecs in the Store: Support for High Efficiency Image (.heif, .heic) files : https://www.microsoft.com/store/productId/9PMMSR1CGPWG Support for WebP image (.webp) files : https://www.microsoft.com/store/productId/9PG2DK419DRG Support for many RAW image files : https://www.microsoft.com/store/productId/9NCTDW2W1BH8
WIC is also used as the underlying codec platform by GDI+ and WinRT Windows.Graphics.Imaging. For example, the forementioned extensions are the official way to support these formats in the Windows 10 Photos app as well.
So adding an SVG codec to WIC would make it possible for users to import SVG images in Win32 and UWP apps without the app having to know anything about SVG, it would just request the appropriate codec for the image selected by the user and ask it to render it in a bitmap buffer to use it.
Some more information:
MS Docs page about writing a WIC decoder: https://docs.microsoft.com/en-us/windows/win32/wic/-wic-implementingwicdecoder
A WIC decoder can replace the shell Thumbnail Provider currently included in PowerToys, as there is a generic thumbnail provider that can handle any file that has a registered WIC decoder: https://docs.microsoft.com/en-us/windows/win32/wic/-wic-integrationregentries#integration-with-the-windows-thumbnail-cache
I would like this too. Especially if it also allowed me to view the SVGs in Explorer.
Two other things I would like to have as a WIC codec would be Animated GIF and Antimated PNG (APNG) support. That would be a different project though.
@Amaroq-Clearwater The current PowerToys include the Explorer preview and thumbnail extensions for SVG. https://docs.microsoft.com/en-us/windows/powertoys/file-explorer This means you should have live icons and previews for SVG files with the current version of PowerToys.
Having an SVG WIC decoder would allow apps that have an "Insert picture" feature based on the standard OS codecs to handle the format transparently. The reason I mentioned the shell Thumbnail Provider is that once we have a WIC codec for the format, we don't need the current Thumbnail Provider anymore, because explorer will automatically rely on the WIC codec to build thumbnails. So we don't need two SVG decoders to maintain, one for thumbnails in explorer and one for WIC-based apps. We could convert the current Thumbnail handler to a WIC decoder and use it for both thumbnails and WIC-based apps.
@Amaroq-Clearwater @PhMajerus in 0.29.x we have a bug that prevents the Explorer SVG previewer from working, but in 0.31 (it will be released next week) the bug is fixed.
Yay
Do you foresee a stable WIC (Windows Imaging Component) implementation that applications can use as a codec, which I think earlier comments mentioned as doable from the work that's already been completed on the thumbnail handler?
SVG is a great format but most applications cannot use it directly, forcing people to export their vector graphics to PNG images before using them in most apps. To improve the use of SVG in Windows, a WIC (Windows Imaging Component) decoder (input codec part only) could be provided. Any application that uses WIC to allow inserting or importing an image would then automatically support SVG files.
Windows 10 already added such WIC codec support for .heif/.heic, .webp and camera raw image files. Similarly, adding SVG would improve the platform and many apps running on Windows. The codec would support rendering the SVG at any pixel size requested by the consuming application, keeping the vector quality.
I submitted this through the Feedback Hub as well: https://aka.ms/AA9c5e8 But I suspect building it as a PowerToy extension and maybe submitting it later for inclusion in Windows or as a standalone Store codec extension, has much more chances of being done. Also, since PowerToys already include an SVG renderer for its Explorer icon and preview handlers, I suspect wrapping the same code in a WIC codec would be easier than starting from scratch.
If you'd like to see this feature implemented, add a 👍 reaction to this post.