Skip to content

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

Open
annuh wants to merge 2 commits into
brefphp:masterfrom
annuh:patch-3
Open

feat(imagick): make convert available in layer#521
annuh wants to merge 2 commits into
brefphp:masterfrom
annuh:patch-3

Conversation

@annuh

@annuh annuh commented Jan 17, 2024

Copy link
Copy Markdown
Contributor

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

Nyholm commented Jan 18, 2024

Copy link
Copy Markdown
Collaborator

Could you tell me why you need convert?

@Nyholm

Nyholm commented Feb 20, 2024

Copy link
Copy Markdown
Collaborator

Friendly ping

@annuh

annuh commented Mar 16, 2024

Copy link
Copy Markdown
Contributor Author

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.

2 participants