[RESOLVED] possible bug -separate -channel IM 6.7.6.8 Q16

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOLVED] possible bug -separate -channel IM 6.7.6.8 Q16

Post by fmw42 »

IM 6.7.6.8 Q16 Snow Leopard.

I am having some consistency problems with separating channels and using one channel for grayscale. Depending upon the approach I use, I either get a colorspace gray result that causes a broken pipe later or a colorspace sRGB result that works fine. I think it has something to do with saving the tmp file as png vs no tmp file.

Also, it does not fail if the tmp file is mpc or miff.

Bad -- colorspace gray:

(Also note the broken pipe -- why???)


convert logo: -colorspace sRGB -channel R -separate 1tmp1.png
data=`convert 1tmp1.png -verbose info:`

echo "data=$data"
data=Image: 1tmp1.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
Gray:
min: 4 (0.0156863)
max: 255 (1)
mean: 229.323 (0.899307)
standard deviation: 69.3423 (0.271931)
kurtosis: 4.45973
skewness: -2.49768
Colors: 150
Histogram:
7150: ( 4, 4, 4) #040404 gray(4,4,4)
247: ( 6, 6, 6) #060606 gray(6,6,6)
.
.
.
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: gray(7,7,7)
Border color: gray(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 640x480+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2012-05-02T18:32:43-07:00
date:modify: 2012-05-02T18:32:43-07:00
png:bKGD : chunk was found (see Background color, above)
png:cHRM : chunk was found (see Chromaticity, above)
png:gAMA : gamma=0.45455 (See Gamma, above)
png:IHDR.bit_depth : 8
png:IHDR.color_type : 0
png:IHDR.interlace_method: 0
png:IHDR.width,height : 640, 480
png:pHYs : x_res=72, y_res=72, units=0
png:sRGB : intent=0 (See Rendering intent)
png:text : 2 tEXt/zTXt/iTXt chunks were found
signature: 46f98f62fb0f37ab60e968a9d9aa123d17d24a20ffc8496cefca2085edbd1453
Artifacts:
filename: 1tmp1.png
verbose: true
Tainted: False
Filesize: 23.4KB
Number pixels: 307K
Pixels per second: 30.72MB
User time: 0.000u
Elapsed time: 0:01.009
Version: ImageMagick 6.7.6-8 2012-04-30 Q16 http://www.imagemagick.org
min=`echo "$data" | sed -n '/^.*[Mm]in:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
-bash: echo: write error: Broken pipe
echo "min=$min"
min=0.0156863



Good - colorspace sRGB:

(no broken pipe)

Last login: Wed May 2 18:32:24 on ttys001
data=`convert logo: -colorspace sRGB -channel R -separate -verbose info:`
echo "data=$data"
data=Image: logo:
Format: GIF (CompuServe graphics interchange format)
Class: DirectClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
Gray:
min: 4 (0.0156863)
max: 255 (1)
mean: 229.323 (0.899307)
standard deviation: 69.3423 (0.271931)
kurtosis: 4.45973
skewness: -2.49768
Colors: 150
Histogram:
7150: ( 4, 4, 4) #040404 srgb(4,4,4)
247: ( 6, 6, 6) #060606 srgb(6,6,6)
.
.
.
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: srgb(4,7,7)
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 640x480+0+0
Dispose: Undefined
Compression: LZW
Orientation: Undefined
Properties:
date:create: 2012-05-02T18:41:53-07:00
date:modify: 2012-05-02T18:41:53-07:00
signature: 46f98f62fb0f37ab60e968a9d9aa123d17d24a20ffc8496cefca2085edbd1453
Profiles:
Profile-icc: 3144 bytes
Description: sRGB IEC61966-2.1
Manufacturer: IEC http://www.iec.ch
Model: IEC 61966-2.1 Default RGB colour space - sRGB
Copyright: Copyright (c) 1998 Hewlett-Packard Company
Artifacts:
colorspace: sRGB
filename: logo:
verbose: true
Tainted: True
Filesize: 0B
Number pixels: 307K
Pixels per second: 30.72MB
User time: 0.010u
Elapsed time: 0:01.009
Version: ImageMagick 6.7.6-8 2012-04-30 Q16 http://www.imagemagick.org
min=`echo "$data" | sed -n '/^.*[Mm]in:.*[(]\([0-9.]*\).*$/{ s//\1/; p; q; }'`
echo "min=$min"
min=0.0156863
Last edited by fmw42 on 2012-05-03T19:08:31-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -separate -channel IM 6.7.6.8 Q16

Post by fmw42 »

Seems to be some difference between my old mac and new mac bash versions. On my new mac, it is intermittent. But Anthony gave me a workaround that appears to work consistently. So this would seem to be closed.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [RESOLVED] possible bug -separate -channel IM 6.7.6.8 Q1

Post by anthony »

As a FYI.

The problem appears to be the 'q' in the "sed" command whcih tells sed to quit when it has found the value wanted and to not bother reading in the read of the piped output (which will not contain any more information).

The work around was to remove the 'q' so "sed" reads all the input that follows (even if useless) so as to not close the pipe and cause a pipe fault. It is intermittent as it probably requires the piped data to be VERY LARGE, perhaps wether the histogram and color tables were included out not, so enough data is pushed to 'fill the pipe' (whcih is not being read) and thus fail.

The "sed" code was then refactored to make use of some shortcuts.

Code: Select all

  min=`echo "$data" | sed -n 's/^.*[Mm]in:.*[(]\([0-9.]*\).*$/\1/p'`
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [RESOLVED] possible bug -separate -channel IM 6.7.6.8 Q1

Post by fmw42 »

It was intermittent on the same file, for anyone interested.
Post Reply