Skip to content

Conversation

@bogdan
Copy link

@bogdan bogdan commented Dec 12, 2025

image/x-raw-sony is a proprietary extension of image/tiff produced by Sony camera with .arw extension.
This PR implements the detection of mime type based on file content (not just extension).

I had a lot of problems finding a sample .arw file of small size. The one inside the repo is not quite real .arw file produced by camera: it is lacking SONY tag and can not be used for "magic" detection.

Because this is proprietary format, it can only be produced by Sony camera and they provide some samples, but the smallest I found was 16MB.
So, I just truncated a file to be smaller and put it to the repo. It can not be opened by image view software, but its first 8KB are enough for mime type detection.

- Add detection for `image/x-raw-sony` format in `lib/marcel/tables.rb`.
- Updated test fixture for Sony RAW image format (`arw.arw`).
- Update `magic_test.rb` to improve error message clarity in assertions.
@bogdan bogdan changed the title Add support for Sony RAW image format Add support for Sony RAW image format magic detection Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant