-
Notifications
You must be signed in to change notification settings - Fork 578
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
Smartcrop is failing in latest ImageMagick #139
Comments
Please include all the steps necessary to reproduce the issue you are reporting. If the issue depends on the environment the code is running in and not just on the smartcrop code please include a Dockerfile to reproduce the issue. |
Thanks for looking into this issue. Please find details below, Node: 20.15.1 Steps to reproduce the issue in windows,
with magick version: 7.1.1-15 (working) cmd: node smartcrop-cli.js C:\test\images\test1.jpg { with magick version: 7.1.1-36 (failing) cmd: node smartcrop-cli.js C:\test\images\test1.jpg Error: Stream yields empty buffer |
In addition, I am not sure whether below is full equivalent of smartcrop command to imagemagick, but when I try below using the latest imagemagick as standalone command it works fine, magick convert C:\work\testdata\images\test1.jpg -crop 4000x4000+0+1992 -resize 4000x4000 -unsharp 2x0.5+1+0.008 -colorspace sRGB -auto-orient -strip -quality 90 C:\work\testdata\images\test1_cropped.jpg |
The problem is, latest image magick versions removed support to legacy "convert" command, it expects command to be "magick". To fix this, performed below actions,
After above 2 fixes, it is working fine. Request to review whether these changes can be implemented. |
The issue with setting imageMagick to 7+ is that it will likely break for a lot of users. Debian (other than experimental) is still on magick 7. As a short term remedy I added a comment to smartcrop-cli clarifying that it requires imagemagick 6. I think longer term the dependency on imagemagick/gm probably just isn't a good idea. The main alternative would be sharp. But even after v0.33 there is no 1.x release of sharp with a stable api (according to semver). The canvas package could be an option but it's dependencies make it a bit of a pain for users as well. Jimp would be nice because it is pure JS, but it's performance is a concern. None of these seem like nice options to me. I'm open for suggestions. |
I agree with your point that short term continue with imagemagick/gm. But long term believe migrating to sharp would be better given its performance advantage and large user base. |
smartcrop is working fine if we are using ImageMagick version 7.1.1-15, but with latest versions 7.1.1-36/7.1.1-38 it is failing with below error,
Error: Stream yields empty buffer
at Socket. (C:\smart\smartcrop\node_modules\gm\lib\command.js:57:17)
at Socket.emit (node:events:531:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
There were some earlier issues addressed as below, not sure whether it is related to this new one,
jwagner/smartcrop-cli#13
The text was updated successfully, but these errors were encountered: