Imagemagick convert command without destinationFile fails

Created on 18 December 2024, 22 days ago

Problem/Motivation

Using: Imagemagick 6 (though from a cursory look, v7 might also have the same issue).

Our custom code runs the following command through ImagemagickExecManager, to get an RGB value back on STDOUT. Notably, this has no destination file. The return value on STDOUT is something like

$ convert /PATH/TO/INPUTFILE[0] -resize 1x1\! -format "%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]" info:-
"129,136,137"

Since 📌 Switch command line escaping to Symfony Process Fixed (i.e. post 8.x-3.6) this does not work anymore, because the destination file is always added to the command. Adding an empty destination file leads to the following (you can try on CLI):

$ convert /PATH/TO/INPUTFILE[0] '-resize' '1x1!' '-format' '"%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]"' 'info:-' ''
convert: no decode delegate for this image format `INFO' @ error/constitute.c/ReadImage/572.
����JFIF``��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 75
��C





 $.' ",#(7),01444'9=82<.342��C


2!!22222222222222222222222222222222222222222222222222�"����������
                                                                 ?����

(The "convert:" line is STDERR, the rest is STDOUT.)

Proposed resolution

Remove the final '' from the command, if $destinationFile is empty; then it works again.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇳🇱Netherlands roderik Amsterdam,NL / Budapest,HU

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024