Problem
HEIC/HEIF images (the default camera format on iPhones since 2018) show "Unable to decode image" in the image viewer. The ImageParser correctly identifies HEIC files by extension and magic bytes (ftyp + brand), but ImageViewer relies on QPixmap.loadFromData() which has no native HEIC support in Qt. I tested on Windows and my Linux (Ubuntu/Debian-based) VM, and neither can render these images inside Crush itself. I tried installing libheif1 on my Linux VM and Microsoft's HEIC/HEVC extensions and it doesn't fix it either. On Mac, this should work natively, as QPixmap.loadFromData() uses Apple's ImageIO/CoreImage under the hood, which has native HEIC support (unverified, no hardware available to test).
Potential Fix
So that all users can quickly view an HEIC, it could be quickly converted to a JPEG at parse time in ImageParser.parse(), before passing those bytes along to the viewer. Doing this in the parser layer makes more sense than in the viewer to me given the image viewer expects raw bytes that it can load with Qt, and that the parser is where the format detection currently lives, but it could technically be handled differently if needed. This approach shouldn't cause any integrity issues as the original bytes wouldn't be touched, and the hex viewer would still run on the original data.
Making this view can be accomplished with pillow and pillow-heif pretty easily, but something to think about is whether to stick to the current behavior on macOS by disabling the conversion on that platform, or converting for all platforms. On macOS it's unnecessary overhead, but technically it's differing behavior between platforms. As of right now, the only way to view an image is to double click on it so the overhead introduced is inconsequential as you are limited by how fast you can click between them. If there is a folder preview mode introduced sometime in the future that has a "thumbnails" view though, doing this for 50+ images at once might cause a delay in loading them.
Problem
HEIC/HEIF images (the default camera format on iPhones since 2018) show "Unable to decode image" in the image viewer. The
ImageParsercorrectly identifies HEIC files by extension and magic bytes (ftyp+ brand), butImageViewerrelies onQPixmap.loadFromData()which has no native HEIC support in Qt. I tested on Windows and my Linux (Ubuntu/Debian-based) VM, and neither can render these images inside Crush itself. I tried installing libheif1 on my Linux VM and Microsoft's HEIC/HEVC extensions and it doesn't fix it either. On Mac, this should work natively, asQPixmap.loadFromData()uses Apple's ImageIO/CoreImage under the hood, which has native HEIC support (unverified, no hardware available to test).Potential Fix
So that all users can quickly view an HEIC, it could be quickly converted to a JPEG at parse time in
ImageParser.parse(), before passing those bytes along to the viewer. Doing this in the parser layer makes more sense than in the viewer to me given the image viewer expects raw bytes that it can load with Qt, and that the parser is where the format detection currently lives, but it could technically be handled differently if needed. This approach shouldn't cause any integrity issues as the original bytes wouldn't be touched, and the hex viewer would still run on the original data.Making this view can be accomplished with pillow and pillow-heif pretty easily, but something to think about is whether to stick to the current behavior on macOS by disabling the conversion on that platform, or converting for all platforms. On macOS it's unnecessary overhead, but technically it's differing behavior between platforms. As of right now, the only way to view an image is to double click on it so the overhead introduced is inconsequential as you are limited by how fast you can click between them. If there is a folder preview mode introduced sometime in the future that has a "thumbnails" view though, doing this for 50+ images at once might cause a delay in loading them.