Page 2 of 2

Re: sampling-factor always similar

Posted: 2013-05-19T23:41:46-07:00
by anthony
Note that in IMv7 there is a clear way for it to decide if an image is grayscale or not.
If it has a single channel it is grayscale. three channels color.

IMv6 unfortunately does not internally have single channel images.

Re: sampling-factor always similar

Posted: 2014-01-15T16:46:43-07:00
by eefi
lahabana wrote:For sure here it is:
Image
GreenKoopa wrote:convert gray.jpg -type TrueColor gray_to_rgb.jpg
convert gray_to_rgb.jpg -format "%r %[channels] %[colorspace]" info:-
PseudoClass Gray gray Gray <= Case 5: fail (the case lahabana needed)
magick wrote:Its a bug and its already fixed. Look for a patch in ImageMagick 6.8.5-7 by sometime tomorrow. Thanks.
Did this regress? I just tried this with ImageMagick 6.8.8-2 built from source on Debian GNU/Linux sid with Debian package libjpeg8-dev version 8d-2, and I saw the same failure GreenKoopa saw with the sample from lahabana.

Re: sampling-factor always similar

Posted: 2014-01-15T16:51:42-07:00
by fmw42
I get no error message for this on IM 6.8.8.2 Q16 Mac OSX

convert 3.jpg -type truecolor 3b.jpg
convert 3b.jpg -format "%r %[channels] %[colorspace]" info:
PseudoClass Gray gray Gray

IM apparently reports a gray image, because it knows it has 3 equal channels. Other tools will likely report it as sRGB, because it sees 3 channels and does not care if equal or not.

see
viewtopic.php?f=2&t=24801

Re: sampling-factor always similar

Posted: 2014-01-15T17:19:54-07:00
by fmw42
I did a test with grayscale jpg and png and Exiftool does not recognize the 3 channels. Perhaps other format specific tools will know the difference.


convert rose: -colorspace gray -type truecolor rose_gray.jpg
Fred-Weinhauss-Mac-mini:desktop fred$ exiftool -s -ee -g1 -u -n -D rose_gray.jpg---- ExifTool ----
- ExifToolVersion : 8.71
---- System ----
- FileName : rose_gray.jpg
- BitsPerSample : 8
- ColorComponents : 1
---- Composite ----
- ImageSize : 70x46


convert rose: -colorspace gray -type truecolor rose_gray.png
Fred-Weinhauss-Mac-mini:desktop fred$ exiftool -s -ee -g1 -u -n -D rose_gray.png---- ExifTool ----
- ExifToolVersion : 8.71
---- System ----
- FileName : rose_gray.png
0 ImageWidth : 70
4 ImageHeight : 46
8 BitDepth : 8
9 ColorType : 0

Re: sampling-factor always similar

Posted: 2014-01-15T20:46:33-07:00
by eefi
Ah, I see now that GreenKoopa's test is not quite correct. However, my original point still stands. When I run

Code: Select all

convert 3.jpg -type TrueColor 3-out.jpg
and open 3-out.jpg in GIMP, GIMP tells me the image mode is Grayscale. However, when I follow snibgo's workaround:
snibgo wrote:But if the image might contain a colour, "-type" does have an effect.

For example (Windows 7, IM 6.8.5):

Code: Select all

convert ^
  3.jpg ^
  ( +clone -fill Red -colorize 100% ) ^
  +swap -composite ^
  -sampling-factor 2x2,1x1,1x1 -type Truecolor r.jpg
the resulting image looks grayscale and is reported gray by GreenKoopa's command, but opening in GIMP says that the image mode is RGB.

This seems to indicate that "-type TrueColor" is still not being fully honored the way the documentation says it should be.

Re: sampling-factor always similar

Posted: 2014-01-15T21:11:44-07:00
by fmw42
I have already posted this to the Bugs forum for the IM developers review. I do not know if it matches your exact conditions. Feel free to add any further comments there. see viewtopic.php?f=3&t=24814