-type command not working

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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -type command not working

Post by magick »

The PNG developer says:
  • I think we mentioned already that "identify" doesn't tell them anything about format that PNG uses. If they only have black pixels, "identify" will tell them it's bilevel no matter how they stored it:

    [studio Forum_bugs]$ cat try.sh
    echo 4.png
    pngcrush -n -v 4.png | grep type
    echo 5.png
    convert 4.png -define png:color-type=2 5.png
    pngcrush -n -v 5.png | grep type
    echo 6.png
    convert 5.png -type TrueColor 6.png
    pngcrush -n -v 6.png | grep type
    identify -verbose 6.png | grep "Type"
    [studio Forum_bugs]$ ./try.sh
    4.png
    Color type=2
    5.png
    Color type=2
    6.png
    Color type=2
    Type: Bilevel
If this does not resolve the issue, it will need to wait. The PNG developer is consumed with another project will not be available for several weeks.
gotskill10
Posts: 17
Joined: 2007-06-02T14:01:34-07:00

Re: -type command not working

Post by gotskill10 »

I don't think this problem is specific to PNG, lets try a JPG example:

$ convert --version
Version: ImageMagick 6.5.9-1 2010-01-28 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
$ curl -O http://s3.amazonaws.com/mixbook/4.jpg
$ convert 4.jpg -type TrueColor 5.jpg
$ identify -verbose 5.jpg | grep "Type"
Type: Bilevel

So its not working with newest version of IM with both JPG and PNG. What am I doing wrong here?
magick wrote:The PNG developer says:
  • I think we mentioned already that "identify" doesn't tell them anything about format that PNG uses. If they only have black pixels, "identify" will tell them it's bilevel no matter how they stored it:

    [studio Forum_bugs]$ cat try.sh
    echo 4.png
    pngcrush -n -v 4.png | grep type
    echo 5.png
    convert 4.png -define png:color-type=2 5.png
    pngcrush -n -v 5.png | grep type
    echo 6.png
    convert 5.png -type TrueColor 6.png
    pngcrush -n -v 6.png | grep type
    identify -verbose 6.png | grep "Type"
    [studio Forum_bugs]$ ./try.sh
    4.png
    Color type=2
    5.png
    Color type=2
    6.png
    Color type=2
    Type: Bilevel
If this does not resolve the issue, it will need to wait. The PNG developer is consumed with another project will not be available for several weeks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -type command not working

Post by magick »

The type returned by identify is the potential type of the image. Even if the image is truecolor, if the color depth is 1 and grayscale, ImageMagick returns BiLevel. This is a design decision. We add debugging to determine more detailed information about the image type. Add -debug coder to your command line when identifying your JPEG image.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: -type command not working

Post by glennrp »

Don't look at the "Type" from identify to see what type of storage an image format used That only tells you the characteristics of the image after ImageMagick has decoded it. Try
  • identify -debug coder -log %e file.png
    pngcheck -v file.png
or
  • pngcrush -n -v file.png
instead.
adrianj

Re: -type command not working

Post by adrianj »

I have been dealing with the same issues and I updated to 6.5.9-1 and with:

convert -background transparent cmyk_spiderweb.svg -format png32 -depth 8 -type TruecolorMatte -define png:color-type=6 cmyk_spiderweb.png

identify -verbose -debug coder -log %e cmyk_spiderweb.png

shows: BiLevel, but

pngcheck -v cmyk_spiderweb.png

shows: 32-bit RGB+alpha
Post Reply