jpegview icon indicating copy to clipboard operation
jpegview copied to clipboard

Modern image codecs supported by WIC

Open kiwijam opened this issue 3 years ago • 21 comments

Thank you for picking up the torch on JPEGView!

It would be nice if JPEGView supported modern image codecs. In particular AVIF.

Chrome, Firefox and Safari support AVIF. Chrome by default. Firefox behind a flag. Safari's AVIF support is limited to its GTK port for now.

JPEG XL and HEIC are also worth investigating. At some point I briefly looked at JPEGView's WIC loader for HEIC but never got it to work properly.

kiwijam avatar May 16 '21 14:05 kiwijam

HEIF/HEIC: I think I was reading from the forum # 93 Support for HEIF image format that David Kleiner (original author) wrote that HEIF is supported in Windows 10 using WIC. Can you test out that suggestion?

AVIF I'll have to go read about... all these new image formats!

sylikc avatar May 18 '21 04:05 sylikc

I extended FilesProcessedByWIC and WIC actually works! Thank you! I've tried HEIC, HEIF and AVIF and they all seem to work fine with Microsoft's WIC extensions.

kiwijam avatar May 18 '21 10:05 kiwijam

AVIF is going to be the Image Format! once it gets adopted by major softwares and browsers no one will look back to the previous formats.

neoOpus avatar May 18 '21 13:05 neoOpus

I extended FilesProcessedByWIC and WIC actually works! Thank you! I've tried HEIC, HEIF and AVIF and they all seem to work fine with Microsoft's WIC extensions.

Thanks for verifying that @kiwijam . I think this will just have to be documented, either in the Readme.html or wiki. Does anyone read the Readme.html btw? (today's the first time I even opened it lol. the program is already so intuitive!)

Or maybe GitHub Pages... though as an offline lean viewer, probably Readme.html

sylikc avatar May 19 '21 20:05 sylikc

I think I was reading from the forum # 93 Support for HEIF image format that David Kleiner (original author) wrote that HEIF is supported in Windows 10 using WIC. Can you test out that suggestion?

I checked that out, but I am still on Windows 7.

However I installed Copytrans a year ago which allows opening HEIC and HEIF files in Windows 7/8/8.1 and also adds thumbnails to HEIC files! Thumbnails don't work with HEIF files, but I got it to work by changing the file extension from .heif to .heic temporarily just to see if that worked. But I don't think they officially support HEIF, which probably only works since it is basically the same format as HEIC with HEIC just being Apple's version of HEIF. https://www.copytrans.net/copytransheic/

I decided to try adding HEIC and HEIF extensions to the FilesProcessedByWIC setting in the ini file, and it worked! I was able to view both file formats in JPEGView.

HEIC takes probably less than half a second to open in JPEGView where any other format opens instantly, and HEIF takes over 5 seconds for JPEGView and even Windows 7 photo viewer to open the image. So the slowness opening these 2 formats is a problem with the WIC codec from Copytrans and not with JPEGView. Luckily IOS devices only use HEIC. Although I wonder if Windows 10 will open HEIF images without the huge delay.

I then tried AVIF, and that didn't work with either JPEGView or Windows 7 photo viewer. So definitely AVIF is not supported by the Copytrans WIC codec. So I guess Windows 7 and 8 don't have support for any other codecs that WIC supports other than HEIC and HEIF. Although I wonder if there is another WIC codec available for Windows 7/8 that supports more file formats and maybe even loads HEIF files faster.

I then realized that in that link you gave, there is someone who already mentions that copytrans works. He also says that copytrans will work with Windows 10, but the copytrans website doesn't mention that. I wouldn't use it for Windows 10 since the Windows 10 WIC codec seems to support more and probably works better.

I also wonder if the Windows 10 WIC codec can somehow be transfered and used on Windows 7. But I will only be able to try to figure that out when I eventually get to fixing my Windows 10 computer. Maybe someone else would be willing to try and figure out if that is possible.

As for adding support for many other formats, I found it interesting that the following webpage mentions that they support many formats using the Magick.NET library. I wonder if it would make it easier for you to support more formats if you were able to incorporate Magick.net in JPEGView. However imageglass loads slowly, hopefully not because of magick.net. https://imageglass.org/docs/supported-formats

OCD-Man avatar Aug 14 '21 02:08 OCD-Man

I just discovered that Transparency for HEIC is not supported in JPEGView or even in Windows 7 Photo Viewer when using the Copytrans WIC codec for HEIC. I'm pretty sure animated HEIC is also not supported.

I suspect that the Windows 10 HEIC codec also doesn't support Transparency since someone had to make a plugin for paint.net to support saving HEIC files with transparency, and when using that plugin, you have to set paint.net to disable its use of the Windows 10 WIC codec for HEIC.

It would be nice if someone could test transparent HEIC with the Windows 10 WIC Codec for HEIC, as well as animated HEIC. The zip file in the following issue I posted has an HEIC image file with transparent and transluscent parts. I don't have an animated HEIC file, so someone will have to make one with an IOS 11 or later device. #13

If transparency is not working for HEIC in Windows 10 with both JPEGView and Windows Photo Viewer, then maybe JPEGView would need to have its own codec for HEIC/HEIF to be able to support transparency rather than just needing to program support for transparency.

Imageglass supports transparency in HEIC files, and their webpage says that they use or incorporate the Magick.NET library. So maybe there is an HEIC codec in the Magick.NET library. And if all you need to do is program another codec to be used to get transparency working, then maybe the Magick.NET library or something similar can be the solution if that makes it easier for you somehow, and may also help make adding other codecs easier. https://imageglass.org/docs/supported-formats

OCD-Man avatar Aug 16 '21 18:08 OCD-Man

@OCD-Man that is some good investigation ... integrating more features for HEIC/HEIF would be interesting, but not something I have bandwidth to investigate at the moment. thanks for taking the time to comment with your detailed research.

sylikc avatar Aug 23 '21 02:08 sylikc

JPEG XL

Is the most important codec here. AVIF isn't really going anywhere while JPEG XL is actually superior.

Pentaphon avatar Oct 01 '21 14:10 Pentaphon

I'm still on WinXP, none of current WIC codec works on it except the very old FastPictureViewer wic codec pack. The more formats competing the less likely they succeed. Look at webp, it came out without worthwhile competitor despite have good windows support (wic, win32 binaries/lib) and backed by chrome's majority marketshare the best it can do is for server caching not as exchange format. Heck even industrial tiff format only added webp as one of its lossy codec few years ago.

JPEG-XL has very very demanding requirement both hardware and build toolchain (how it expect to be universal? unbelievable!) HEIC is just Apple proprietary ploy and they will still "happy" even when none of non-iSheep adopt it. AVIF will certainly replace webp (already seen it used for image caching) but nothing more. no individual care about squeezing some KB for incompatibility. Image format wars is similar to archive and audio format war (we still use zip and mp3 for exchange).

just my 2c rant.

tumagonx avatar Oct 12 '21 01:10 tumagonx

I think libheif is best minimal library that can be build with visual c++ for jpegview. You get avif and heic support.

tumagonx avatar Oct 12 '21 02:10 tumagonx

JPEG-XL has very very demanding requirement both hardware and build toolchain

The namesake of this project alone means it should have JPEG-XL support. When JPEG-XL becomes widely used, and JPEGView doesn't have support, people are going to ask: "what is the point of this project if it doesn't even support the latest JPEG standard?"

If anything, JPEG-XL should be the highest priority for this project because:

  1. HEIC is a closed format that people were never excited about using and this is an open source project.
  2. AVIF is inferior to JPEG-XL in every comparison and the AVIF hype is dying down due to such data.
  3. JPEG-XL is not yet widely used, giving this project plenty of time to figure out how to support it, and interest is growing.
  4. Again, it's silly to have an image viewer called JPEGView not be able to view JPEG-XL when it becomes widely used.

Pentaphon avatar Oct 12 '21 03:10 Pentaphon

https://github.com/libjxl/libjxl

neoOpus avatar Oct 12 '21 06:10 neoOpus

It's nice to see how many people aside from myself who use JPEGView as their primary viewer. I haven't actually analyzed the code enough to add a new codec support, but this is encouraging me to dig in. If I have time to start looking into adding a new file format support, JPEG-XL will be the first one I look at.

I had a problem with CR3 files a few weeks back that I wished JPEGView can pull the RAW previews from too. Ah, so many enhancements!

sylikc avatar Oct 12 '21 20:10 sylikc

I extended FilesProcessedByWIC and WIC actually works! Thank you! I've tried HEIC, HEIF and AVIF and they all seem to work fine with Microsoft's WIC extensions.

Unfortunately, in my case it doesn't work. Windows 11 x64, JPEGView 1.0.40 with FilesProcessedByWIC=.wdp;.hdp;.jxr,.heic , the message is "Cannot read file 20220416_134424.heic". The example photo attached 20220416_134424.zip. Windows "Photos" and "Windows Photo Viewer" open the file successfully

kiawizard avatar Apr 17 '22 08:04 kiawizard

The photo seems to work fine for me.

Here's the line from my INI: FilesProcessedByWIC=*.dds;*.wdp;*.hdp;*.jxr;*.avif;*.heic;*.heif;*.jxl

Here's the extensions (all by Microsoft) I installed from the Windows Store:

HEIF Image Extensions
WebP Image Extensions
Raw Image Extension
Web Media Extensions
AV1 Video Extension
VP9 Video Extensions
MPEG-2 Video Extension
HEVC Video Extensions (Device)

kiwijam avatar Apr 17 '22 10:04 kiwijam

kiwijam, thank you, I think I missed the fact that ini is overridden with the one in user's profile. Edited it through a link in jpegview's context menu, and now it works indeed!

kiawizard avatar Apr 17 '22 12:04 kiawizard

kiwijam, and does it work if you right-click the image, Open With, choose jpegiew? In my case it still says "Cannot read file" then, but works if I run jpegview, press Ctrl+O or use an auto-opened file dialog and select the image. Interesting that drag'n'drop of the image to jpegview's window produces the same error too

kiawizard avatar Apr 17 '22 13:04 kiawizard

Yes, I tried DnD & Open With, both work fine with the HEIC file. No idea really :(

My registry entries look like this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.heic]
@="heic_auto_file"
"ContentType"="image/HEIC"
"PerceivedType"="image"

[HKEY_CLASSES_ROOT\heic_auto_file\shell\open\command]
@="\"D:\\Dropbox\\bin\\JPEGView64\\JPEGView.exe\" \"%1\""

Maybe Windows settings > "Choose a default app for each type of file"?

kiwijam avatar Apr 17 '22 13:04 kiwijam

Certainly a Windows issue: although I chose "always use this app" in OpenWith dialog, the registry key ...\shell\open\command remained leading somewhere to Windows Photo Viewer. Changed registry value to the one you provided, and now everything works like a charm, thank you!

kiawizard avatar Apr 17 '22 13:04 kiawizard

@kiwijam

Here's the line from my INI: FilesProcessedByWIC=*.dds;*.wdp;*.hdp;*.jxr;*.avif;*.heic;*.heif;*.jxl Here's the extensions (all by Microsoft) I installed from the Windows Store:

Your INI line includes JXL but none of the listed extensions seems to support it. Did you get .jxl images working in jpegview and if yes what extension or other install is it dependent on?

nod5 avatar Apr 19 '22 14:04 nod5

Yep! There's a WIC loader over here: https://github.com/saschanaz/jxl-winthumb/

jxl-winthumb
A JPEG XL (*.jxl) thumbnail handler for Windows File Explorer.

Now with WIC decoding support, which means you can use Windows Photo Viewer or any WIC-capable image viewers to view JXL files.

kiwijam avatar Apr 20 '22 08:04 kiwijam

JPEG XL support was just merged in via PR #99

sylikc avatar Jan 07 '23 04:01 sylikc

JPEG XL support was just merged in via PR #99

Awesome! Also, please don't worry about HEIC. Nobody really uses HEIC and I think the people who really love this project want support for open-source image codecs and that's it.

JPEG-XL was the first priority because it is a true successor to JPEG, the namesake of this project, and now that that is done, the only remaining open source codec to support is AVIF, but even I think that will be replaced by JPEG XL someday.

Pentaphon avatar Jan 07 '23 04:01 Pentaphon

Nobody uses HEIC? It is one of two formats along with jpeg (which is too old to be used) available in cameras of modern smartphones. I use HEIC and I use jpegview to view them perfectly, even 108mp

kiawizard avatar Jan 07 '23 08:01 kiawizard

Nobody uses HEIC?

Not enough to make it worth the trouble. JPEG-XL will eventually replace it. I have never gotten an HEIC image from an iPhone or Galaxy user.

Pentaphon avatar Jan 07 '23 08:01 Pentaphon

Which trouble? What makes you think jpeg-xl will replace it? Haven't ever seen anything which produces jpeg-xl

kiawizard avatar Jan 07 '23 08:01 kiawizard

Which trouble? What makes you think jpeg-xl will replace it? Haven't ever seen anything which produces jpeg-xl

Battle-of-the-Codecs_fnl

Pentaphon avatar Jan 07 '23 08:01 Pentaphon

Nice theoretical picture, and which devices support it or are going to support it? What makes you think it won't share the fate of jpeg2000, which is very very good, except not used anywhere?

kiawizard avatar Jan 07 '23 09:01 kiawizard

Nice theoretical picture, and which devices support it or are going to support it? What makes you think it won't share the fate of jpeg2000, which is very very good, except not used anywhere?

Find me an open source codec that outperforms JPEG-XL and I will go with that instead.

Pentaphon avatar Jan 07 '23 09:01 Pentaphon

Go where? Camera makers choose formats, picture viewers have to be able to show them all. Personally I store every jpeg in Dropbox Lepton format (lossless 30% compression for jpeg), shoot in HEIC, edit in WEBP, and view all 3 in jpegview

kiawizard avatar Jan 07 '23 09:01 kiawizard