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

feat(imagick): make convert available in layer #521

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

annuh
Copy link
Contributor

@annuh annuh commented Jan 17, 2024

Running convert directly does not work.

For example:

exec('convert --version');

triggers this error:

sh: convert: command not found

This PR makes convert available in the Imagick layer.

@Nyholm
Copy link
Collaborator

Nyholm commented Jan 18, 2024

Could you tell me why you need convert?

@Nyholm
Copy link
Collaborator

Nyholm commented Feb 20, 2024

Friendly ping

@annuh
Copy link
Contributor Author

annuh commented Mar 16, 2024

I'm sorry for the late reply!

My initial though was, if the Imagick Bref extension includes Ghostscript (gs), why not also include convert.
In one of our serverless applications, we used to invoke convert directly, but I didn't realize we could replace this with the PHP Imagick extension. 🙂 For example

-exec("convert compare -metric AE '{$image1}' '{$image2}' NULL:", $output);
-$similarity = (float) $output[0];
+$similarity = (new \Imagick($image1))->compareImages(new \Imagick($image2), \Imagick::METRIC_ABSOLUTEERRORMETRIC)[1];

After these changes, we don't need the imagick binary anymore. But maybe it can be a useful for other use cases?
If you think it's not needed, I'll close this PR 🙂

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.

None yet

2 participants