Repository navigation
Conversation
Some exports (e.g. Google Photos downloads) save JPEGs under the original .ARW/.RW2 filename. RapidRAW picked the decoder purely by extension, so rawler failed with "No decoder found, model '', make: ''" and the images could not be opened. Check the file signature in load_base_image_from_bytes and fall back to the standard image decoder when a RAW-named file is actually a JPEG or PNG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some photo exports, notably Google Photos downloads, save JPEGs under the original RAW filename (
DSC03621.ARW,P1000123.RW2, ...). RapidRAW picks the decoder from the extension alone, so these files go to rawler, which fails because there is no TIFF/RAW container:Opening such a folder fails for every image. In the case that prompted this PR, all 567
.ARW/.RW2files in the folder were JPEGs (FF D8 FF E0 ... JFIF).Fix
formats::has_non_raw_image_signature(bytes)checks the JPEG (FF D8 FF) and PNG magic bytes. None of the supported RAW containers start with either (TIFF-basedII*\0/MM\0*, RW2IIU\0, CR3 ISO-BMFF, RAFFUJIFILM, X3FFOVb, CRW CIFF, ...).load_base_image_from_bytesuses this to skip the RAW pipeline (both Apple RAW 9 and rawler) and decode the file with the standard image decoder, which already detects the format from the content and applies EXIF orientation. An info line is logged when this happens.is_raw_filestays extension-only. It has ~30 call sites, many of them in folder listing and some that run on paths without bytes, so content sniffing belongs at the point where the bytes are decoded.Testing
formats.rs(JPEG/PNG detected, TIFF/RAF/empty input not)..ARWfiles throughload_base_image_from_bytes: it now decodes (4894×3269) instead of erroring.cargo fmt --checkandcargo clippy --all-targets -- -D warningspass on Windows. I couldn't run clippy with--all-featureslocally because there's no libgphoto2 on Windows.🤖 Generated with Claude Code