Despite claiming otherwise, the ImageMagick library does rely on the filename extension when detecting filetypes. If there is no filename extension it will make a best guess based on the file's headers. This means that sometimes if you feed it a CR2 (Canon Raw) file it will assume it is being asked to convert a TIFF, and the library (or delegate) ImageMagick uses for TIFFs will fail when it finds missing headers:
To make a long story short this leads to unpredictable processing of image files that should be processable.
Since we follow the best practice of never storing user-supplied filenames on S3 we run into this error fairly consistently. This makes it difficult for ImageMagick to select the correct delegate (dcraw for raw, libtiff for tiff, etc) with which to process the image. One thing we might want to consider is how we can modify the request we send to ImageMagick itself.
Clicking here should download a sample .CR2 file which is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.
Since #32 this should in theory work by prefixing the path to the tempfile with the magick coder name, like so: cr2:some-file.cr2 - at least that's how it works with convert, so might be easier to do now š¤
Despite claiming otherwise, the ImageMagick library does rely on the filename extension when detecting filetypes. If there is no filename extension it will make a best guess based on the file's headers. This means that sometimes if you feed it a CR2 (Canon Raw) file it will assume it is being asked to convert a TIFF, and the library (or delegate) ImageMagick uses for TIFFs will fail when it finds missing headers:
To make a long story short this leads to unpredictable processing of image files that should be processable.
Since we follow the best practice of never storing user-supplied filenames on S3 we run into this error fairly consistently. This makes it difficult for ImageMagick to select the correct delegate (dcraw for raw, libtiff for tiff, etc) with which to process the image. One thing we might want to consider is how we can modify the request we send to ImageMagick itself.
Clicking here should download a sample .CR2 file which is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.