Skip to content
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

PHP Imagick::readImageFile NEF filehandle detected as TIFF #685

Open
t-rutter opened this issue Aug 13, 2024 · 3 comments
Open

PHP Imagick::readImageFile NEF filehandle detected as TIFF #685

t-rutter opened this issue Aug 13, 2024 · 3 comments

Comments

@t-rutter
Copy link

Try to read an open filehandle results in imagemagick detect the fiel as a TIFF and then only reads the low-res preview.
`
$filename='_X000001.NEF';
$preview='_X000001.jpg'
$fh = fopen("/src-dir/$filename", "r");
$im->readImageFile($fh);
$imageinfo = $im->identifyImage();
$im->resizeImage(1024, 768, Imagick::FILTER_LANCZOS, 1);
$im->setImageFormat('jpg');
$im->writeImage("/dst-dir/$preview");
$im->clear();
$im->destroy();

// do other stuff with source file

fclose($fh);
`
results in $imageinfo showing format = "TIFF (Tagged Image File Format)"
and the output jpg is super blurry as it end being scaled up from the NEF preview a tiny 160x120px, instead of the full size NEF 3280x4928

@mnogueron
Copy link

I'm encountering the same issue with NEF pictures within the Memories app of Nextcloud.
They are using readImageBlob which picks the TIFF thumbnail instead of the source file (for ref: pulsejet/memories#1054)

@Danack
Copy link
Collaborator

Danack commented Oct 19, 2024

Hi, I won't be able to fix this in Imagick. Imagick is a thin wrapper around ImageMagick and so Imagick doesn't do any of the image processing itself.

I'd suggest reporting the issue at https://github.com/ImageMagick/ImageMagick

But also:

  1. Try to replicate the issue using the command line ImageMagick tools. If you can do that, the maintainers of ImageMagick are far more likely to look at the issue quickly.

  2. If you can't reproduce via the command line, making an example standalone C problem is another way of getting the ImageMagick maintainers to look at the problem. There's an example stub program you could base something on here: https://github.com/Imagick/imagemagicktest/blob/0be293bb3bf2b4bc6def249d585fb13f6572db1a/svgtest.c

If those fail, and the ImageMagick maintainers don't do anything, then post an example file here (I guess zipped up to get past githubs upload rules).

@mnogueron
Copy link

mnogueron commented Dec 17, 2024

@Danack Thanks for the reply, I'll look into your recommendations when I have some free time.
If you want to check some example files I've sent some zipped files in this issue on Memories: pulsejet/memories#1054

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

No branches or pull requests

3 participants