-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RAW images give "Input file contains unsupported image format", but vips/ImageMagick handle them fine #2867
Comments
RAW images often masquerade as TIFF images, which these examples appear to do also, so libvips will use libtiff to open these however they aren't quite valid TIFF images and fail.
#2852 provides a suggested workaround for changing the priority of magickload. |
Thanks for the information, that's very helpful. The priority workaround in #2852 makes sense, but I'd love the ability to continue using the libvips native TIFF support as well. If I understand correctly, changing the priority would have the same basic effect as configuring libvips My plan was to detect raw images based on Sharp's metadata output, then convert them to TIFF with |
I've not tried it, but I'm aware that one of the developers at Elastic (who use sharp in some of their tooling) created https://github.com/justinkambic/libraw.js that might help. Given you need to support both TIFF and RAW files, a possible workflow might be when sharp/libvips thinks a file is TIFF but then generates a decoding error, you could fall back to trying libraw.js next. |
I'm going to close this issue, as it doesn't sound like there's anything actionable on the sharp side of things. I ended up bypassing sharp for reading metadata entirely. For my case, I need to support as many image input formats as possible, including camera RAW images. My current implementation has to write 1-2 tempfiles to disk, but in my testing that adds 10s of milliseconds to a process that takes 1000s (mostly sharp operations and network transfer), so I'm happy with that tradeoff. Additionally, I do not have to use libvips
|
I currently have
lovell/sharp
specified in package.json, as reproducing this issue requires the fix for #2864.I've updated the example repo from my last issue with steps: https://github.com/paulstraw/sharp-magick-lambda
Metadata can be extracted from camera RAW files.
https://github.com/paulstraw/sharp-magick-lambda
Sample images in the linked repo
npx: installed 1 in 2.449s System: OS: Linux 5.10 Amazon Linux 2 CPU: (4) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Memory: 667.21 MB / 1.94 GB Container: Yes Shell: 4.2.46 - /bin/bash Binaries: Node: 14.17.5 - /var/lang/bin/node npm: 6.14.14 - /var/lang/bin/npm
The text was updated successfully, but these errors were encountered: