Red Hat Bugzilla – Bug 111126
identify command adds extra newline to formatted output
Last modified: 2007-11-30 17:10:34 EST
From Bugzilla Helper:
Description of problem:
The format flag on the identify command within ImageMagick appears to
have an erroneous newline added to the end. According to the docs,
there are flags for adding newline if using the format flag. However,
this version appears to be adding at least one newline.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. /usr/bin/identify -ping -format "%w %h %m %b" imagename
2. Note newline on output
Command returns: "1600 1200 JPEG 441.4k\n"
"1600 1200 JPEG 441.4k
Command to return: "1600 1200 JPEG 441.4k"
The format flag has a character for newline and/or linefeed, which
will add an additional newline or linefeed. This bug is causing
problems with a PHP script which attempts to read the output sans
newline and put it into an array. Previous behavior excluded the
newline. Other programs which utilize imagemagick in this manner
would have similar problems.
Other lines like it exist within the source. Either this line, or the
function ConcatenateString need to make concatenating a newline
conditional on the format flag. If format is used and no "\n" is
contained, no \n should be concatenated.
Commenting out this line and rebuilding seems to solve my problem for
script output, but probably breaks other functionality.
It would appear that previous versions used something similar, so it
would appear that an additional newline is being introduced within a
The presence of this as well as the initial line appears to be
creating two newlines. IMHO, one or the other should go. the line
within identify.c seems to have been present in previous (<=5.4.x)
Owner has patch 5.5.8 upstream beta, will be available via FTP within
a couple of days.
Fixed at least in current ImageMagick-126.96.36.199-2.fc3.
I suggest to close this.