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): ImageMagick-5.5.6-5 How reproducible: Always Steps to Reproduce: 1. /usr/bin/identify -ping -format "%w %h %m %b" imagename 2. Note newline on output Actual Results: Command returns: "1600 1200 JPEG 441.4k\n" or "1600 1200 JPEG 441.4k " Expected Results: Command to return: "1600 1200 JPEG 441.4k" Additional info: 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.
File magick/command.c Line 3388: (void) ConcatenateString(&(*metadata),"\n"); 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 different function.
utilities/identify.c: Line 194: (void) fputc('\n',stdout); 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) versions.
Owner has patch 5.5.8 upstream beta, will be available via FTP within a couple of days. Reference http://studio.imagemagick.org/magick/viewtopic.php?p=2054#2054 -Rick
Fixed at least in current ImageMagick-6.2.2.0-2.fc3. I suggest to close this.