A further observation (which may help in tracking down this bug) is that calling an fx:mean.g causes Identify to stop working correctly.
Using: HDRI - Version: ImageMagick 7.0.5-1 Q16 x86_64 2017-03-05
By way of example
Code: Select all
# Load in image
my $image = Image::Magick->new;
open(IMAGE, 'r.png');
$image->Read(file=>\*IMAGE);
close(IMAGE);
# Check values
$image->Identify();
# Call fx:mean
print "Mean g = ".$image->Get('%[fx:mean.g]')."\n";
#Check values
$image->Identify();
$image->Display();
The first call to Identify yields this (all seems OK)
Code: Select all
Image: /tmp/magick-7481OttXQw0DHfog
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 70x46+0+0
Units: Undefined
Type: TrueColor
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Channel statistics:
Pixels: 3220
Red:
min: 35 (0.137255)
max: 255 (1)
mean: 145.712 (0.57142)
standard deviation: 69.306 (0.271788)
kurtosis: -1.386
skewness: 0.146302
entropy: 0.966517
Green:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4779 (0.205796)
kurtosis: 2.63548
skewness: 1.81809
entropy: 0.863321
Blue:
min: 24 (0.0941176)
max: 255 (1)
mean: 80.4683 (0.315562)
standard deviation: 55.12 (0.216157)
kurtosis: 3.01445
skewness: 1.97858
entropy: 0.847573
Image statistics:
Overall:
min: 22 (0.0862745)
max: 255 (1)
mean: 105.147 (0.412341)
standard deviation: 66.082 (0.259145)
kurtosis: -0.206434
skewness: 1.06132
entropy: 0.89247
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)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 70x46+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2017-03-07T13:08:30+00:00
date:modify: 2017-03-07T13:08:30+00:00
filter:brightness:kurtosis: 0.588352
filter:brightness:mean: 29310.5
filter:brightness:skewness: 0.850459
filter:brightness:standard-deviation: 13019.8
filter:saturation:kurtosis: -1.03996
filter:saturation:mean: 27068.9
filter:saturation:skewness: 0.44897
filter:saturation:standard-deviation: 19280.3
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45454544 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 2
png:IHDR.color_type: 2 (Truecolor)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 70, 46
png:sRGB: intent=0 (Perceptual Intent)
png:text: 10 tEXt/zTXt/iTXt chunks were found
signature: f7b3db46d6f696ea8392f0ad0be945dd502a806e2c1e9c082efef517191758f7
Tainted: False
Filesize: 7.36KB
Number pixels: 3.22K
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 7.0.5-1 Q16 x86_64 2017-03-05 http://www.imagemagick.org
But the second call (following fx:mean.g execution) yields wierd results for the red & blue channel.
Code: Select all
Image: /tmp/magick-7481OttXQw0DHfog
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 70x46+0+0
Units: Undefined
Type: TrueColor
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
Red: 1-bit
Green: 8-bit
Blue: 1-bit
Channel statistics:
Pixels: 3220
Red:
min: inf (2.7431e+303)
max: -inf (-2.7431e+303)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: -3
skewness: 0
entropy: 0
Green:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4779 (0.205796)
kurtosis: 2.63548
skewness: 1.81809
entropy: 0.863321
Blue:
min: inf (2.7431e+303)
max: -inf (-2.7431e+303)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: -3
skewness: 0
entropy: 0
Image statistics:
Overall:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4779 (0.205796)
kurtosis: 2.63548
skewness: 1.81809
entropy: 0.287774
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)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 70x46+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2017-03-07T13:08:30+00:00
date:modify: 2017-03-07T13:08:30+00:00
filter:brightness:kurtosis: 0.588352
filter:brightness:mean: 29310.5
filter:brightness:skewness: 0.850459
filter:brightness:standard-deviation: 13019.8
filter:saturation:kurtosis: -1.03996
filter:saturation:mean: 27068.9
filter:saturation:skewness: 0.44897
filter:saturation:standard-deviation: 19280.3
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45454544 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 2
png:IHDR.color_type: 2 (Truecolor)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 70, 46
png:sRGB: intent=0 (Perceptual Intent)
png:text: 10 tEXt/zTXt/iTXt chunks were found
signature: f7b3db46d6f696ea8392f0ad0be945dd502a806e2c1e9c082efef517191758f7
Tainted: False
Filesize: 7.36KB
Number pixels: 3.22K
Pixels per second: 107KB
User time: 0.030u
Elapsed time: 0:01.029
Version: ImageMagick 7.0.5-1 Q16 x86_64 2017-03-05 http://www.imagemagick.org
Also, this demonstrates the strange appearance of a 4th channel when converting from sRGB to XYZ
Code: Select all
# Load in image
my $image = Image::Magick->new;
open(IMAGE, 'r.png');
$image->Read(file=>\*IMAGE);
close(IMAGE);
$image->Set(alpha=>'Set');
$image->Identify();
# Set colorspace to XYZ
$image->Colorspace(colorspace=>"XYZ");
# Check values
$image->Identify();
First identify after adding alpha - all seems OK
Code: Select all
Image: /tmp/magick-7522Kf6zxDfhLnDl
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 70x46+0+0
Units: Undefined
Type: TrueColorAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 1-bit
Channel statistics:
Pixels: 3220
Red:
min: 35 (0.137255)
max: 255 (1)
mean: 145.712 (0.57142)
standard deviation: 69.306 (0.271788)
kurtosis: -1.386
skewness: 0.146302
entropy: 0.966517
Green:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4779 (0.205796)
kurtosis: 2.63548
skewness: 1.81809
entropy: 0.863321
Blue:
min: 24 (0.0941176)
max: 255 (1)
mean: 80.4683 (0.315562)
standard deviation: 55.12 (0.216157)
kurtosis: 3.01445
skewness: 1.97858
entropy: 0.847573
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: 0 (0)
kurtosis: -3
skewness: 1e+45
entropy: -nan
Image statistics:
Overall:
min: 22 (0.0862745)
max: 255 (1)
mean: 142.61 (0.559256)
standard deviation: 86.5208 (0.339297)
kurtosis: -1.67099
skewness: 0.273474
entropy: -nan
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)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 70x46+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2017-03-07T13:19:59+00:00
date:modify: 2017-03-07T13:19:59+00:00
filter:brightness:kurtosis: 0.588352
filter:brightness:mean: 29310.5
filter:brightness:skewness: 0.850459
filter:brightness:standard-deviation: 13019.8
filter:saturation:kurtosis: -1.03996
filter:saturation:mean: 27068.9
filter:saturation:skewness: 0.44897
filter:saturation:standard-deviation: 19280.3
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45454544 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 2
png:IHDR.color_type: 2 (Truecolor)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 70, 46
png:sRGB: intent=0 (Perceptual Intent)
png:text: 10 tEXt/zTXt/iTXt chunks were found
signature: 646ac633d5b5553721e032d2c9f8f54ffc19d315832bbf808c2b7321b1067293
Tainted: True
Filesize: 7.36KB
Number pixels: 3.22K
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 7.0.5-1 Q16 x86_64 2017-03-05 http://www.imagemagick.org
... and after the conversion to XYZ - Note the appearance of channel 3 (a 4th channel in addition to the alpha channel).
Code: Select all
Image: /tmp/magick-7522Kf6zxDfhLnDl
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 70x46+0+0
Units: Undefined
Type: TrueColorAlpha
Endianess: Undefined
Colorspace: XYZ
Depth: 8/16-bit
Channel depth:
Channel 0: 16-bit
Channel 1: 16-bit
Channel 2: 16-bit
Channel 3: 1-bit
Alpha: 1-bit
Channel statistics:
Pixels: 3220
Channel 0:
min: 4.67681 (0.0183404)
max: 242.37 (0.95047)
mean: 59.3238 (0.232642)
standard deviation: 53.9999 (0.211764)
kurtosis: 3.09181
skewness: 1.71244
entropy: 0.99008
Channel 1:
min: 4.71418 (0.018487)
max: 255 (1)
mean: 49.9844 (0.196017)
standard deviation: 53.9142 (0.211428)
kurtosis: 6.58834
skewness: 2.58778
entropy: 0.989499
Channel 2:
min: 4.05614 (0.0159064)
max: 277.652 (1.08883)
mean: 38.7033 (0.151778)
standard deviation: 62.891 (0.246631)
kurtosis: 6.5241
skewness: 2.74042
entropy: 0.970848
Channel 3:
min: inf (2.7431e+303)
max: -inf (-2.7431e+303)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: -3
skewness: 0
entropy: 0
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: 0 (0)
kurtosis: -3
skewness: 1e+45
entropy: -nan
Image statistics:
Overall:
min: 4.05614 (0.0159064)
max: 277.652 (1.08883)
mean: 100.753 (0.395109)
standard deviation: 102.12 (0.400472)
kurtosis: -1.29352
skewness: 0.714799
entropy: -nan
Rendering intent: Undefined
Gamma: 1
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 70x46+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2017-03-07T13:19:59+00:00
date:modify: 2017-03-07T13:19:59+00:00
filter:brightness:kurtosis: 0.588352
filter:brightness:mean: 29310.5
filter:brightness:skewness: 0.850459
filter:brightness:standard-deviation: 13019.8
filter:saturation:kurtosis: -1.03996
filter:saturation:mean: 27068.9
filter:saturation:skewness: 0.44897
filter:saturation:standard-deviation: 19280.3
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45454544 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 2
png:IHDR.color_type: 2 (Truecolor)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 70, 46
png:sRGB: intent=0 (Perceptual Intent)
png:text: 10 tEXt/zTXt/iTXt chunks were found
signature: 0f68be1e03acd2acd9fed6839a05475cb0f5025797d317130edc1f96a779effe
Tainted: True
Filesize: 7.36KB
Number pixels: 3.22K
Pixels per second: 107KB
User time: 0.050u
Elapsed time: 0:01.030
Version: ImageMagick 7.0.5-1 Q16 x86_64 2017-03-05 http://www.imagemagick.org
mike@mike-VirtualBox:
This one may be a separate bug (but might be connected to the statistics issue), which appeared after the recent inclusion of the Colorspace() function into perlmagick. (see
viewtopic.php?f=7&t=30994