Page 1 of 1

IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T11:28:25-07:00
by jverne
Color reduction / color palette optimization doesn't seem to be working as advertised on IM 6.7.1 Q16 / Win XP.

Lets take the following image with 603 unique colors:

http://www.imagemagick.org/Usage/anim_opt/speed.gif

Using the following command:

Code: Select all

convert -colors 256 speed.gif speed_opt.gif
there is no reduction in file size, so this seem to indicate that the parameter number in -colors number is the maximum number of colors each local or global color palette can have.

On the other hand the FAQ for -colors number says:
The actual number of colors in the image may be less than your request, but never more. Note that this a color reduction option. Images with fewer unique colors than specified by value will have any duplicate or unused colors removed. The ordering of an existing color palette may be altered. When converting an image from color to grayscale, it is more efficient to convert the image to the gray colorspace before reducing the number of colors.
Testing it on the following animated gif with lots of unused colors:

http://imageshack.us/photo/my-images/406/square1.gif/

using the command:

Code: Select all

convert -colors 1 square1.gif square2.gif
the file size is reduced to 317 bytes (each frame has only one color), but the following command

Code: Select all

convert -colors 256 square1.gif square1_opt.gif
does not reduce the file size, so it is not removing unused colors from color palette as advertised. So, unfortunately, this command is not an easy way of optimizing color palettes (i.e. removing duplicated or unused colors).

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T11:40:00-07:00
by fmw42
You may need to post links to your images or report the identify -verbose yourimage results.

But the correct syntax, though it may not make a difference is

convert square1.gif -colors 256 square1_opt.gif

But as gif is limited to 256 colors already, it probably won't change, though it might be some fewer. It is generally when you specify less colors than is in the image, that this makes sense, i.e.


convert square1.gif -colors 128 square1_opt.gif


or -colors 16


see

http://www.imagemagick.org/Usage/quantize/#intro

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T12:51:36-07:00
by jverne
Hi fmw42,

I'm sorry that it was not clear that the second test image was this one:

http://desmond.imageshack.us/Himg406/sc ... es=landing

Unfortunately, the correct ordering doesn't seem to change anything, i.e. duplicated or unused colors on color palettes are not removed.

Now follow the identify -verbose for square1.gif and square2.gif respectively:

Code: Select all

Image: square1.gif
  Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 100x100+0+0
  Resolution: 72x72
  Print size: 1.38889x1.38889
  Units: Undefined
  Type: Bilevel
  Base type: Bilevel
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8/4-bit
  Channel depth:
    gray: 1-bit
  Channel statistics:
    Gray:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
     10000: (  0,  0,  0) #000000 black
  Colormap: 256
         0: (255,255,255) #FFFFFF white
         1: (255,255,204) #FFFFCC rgb(255,255,204)
         2: (255,255,153) #FFFF99 rgb(255,255,153)
         3: (255,255,102) #FFFF66 rgb(255,255,102)
         4: (255,255, 51) #FFFF33 rgb(255,255,51)
         5: (255,255,  0) #FFFF00 yellow
         6: (255,204,255) #FFCCFF rgb(255,204,255)
         7: (255,204,204) #FFCCCC rgb(255,204,204)
         8: (255,204,153) #FFCC99 rgb(255,204,153)
         9: (255,204,102) #FFCC66 rgb(255,204,102)
        10: (255,204, 51) #FFCC33 rgb(255,204,51)
        11: (255,204,  0) #FFCC00 rgb(255,204,0)
        12: (255,153,255) #FF99FF rgb(255,153,255)
        13: (255,153,204) #FF99CC rgb(255,153,204)
        14: (255,153,153) #FF9999 rgb(255,153,153)
        15: (255,153,102) #FF9966 rgb(255,153,102)
        16: (255,153, 51) #FF9933 rgb(255,153,51)
        17: (255,153,  0) #FF9900 rgb(255,153,0)
        18: (255,102,255) #FF66FF rgb(255,102,255)
        19: (255,102,204) #FF66CC rgb(255,102,204)
        20: (255,102,153) #FF6699 rgb(255,102,153)
        21: (255,102,102) #FF6666 rgb(255,102,102)
        22: (255,102, 51) #FF6633 rgb(255,102,51)
        23: (255,102,  0) #FF6600 rgb(255,102,0)
        24: (255, 51,255) #FF33FF rgb(255,51,255)
        25: (255, 51,204) #FF33CC rgb(255,51,204)
        26: (255, 51,153) #FF3399 rgb(255,51,153)
        27: (255, 51,102) #FF3366 rgb(255,51,102)
        28: (255, 51, 51) #FF3333 rgb(255,51,51)
        29: (255, 51,  0) #FF3300 rgb(255,51,0)
        30: (255,  0,255) #FF00FF magenta
        31: (255,  0,204) #FF00CC rgb(255,0,204)
        32: (255,  0,153) #FF0099 rgb(255,0,153)
        33: (255,  0,102) #FF0066 rgb(255,0,102)
        34: (255,  0, 51) #FF0033 rgb(255,0,51)
        35: (255,  0,  0) #FF0000 red
        36: (204,255,255) #CCFFFF rgb(204,255,255)
        37: (204,255,204) #CCFFCC rgb(204,255,204)
        38: (204,255,153) #CCFF99 rgb(204,255,153)
        39: (204,255,102) #CCFF66 rgb(204,255,102)
        40: (204,255, 51) #CCFF33 rgb(204,255,51)
        41: (204,255,  0) #CCFF00 rgb(204,255,0)
        42: (204,204,255) #CCCCFF rgb(204,204,255)
        43: (204,204,204) #CCCCCC grey80
        44: (204,204,153) #CCCC99 rgb(204,204,153)
        45: (204,204,102) #CCCC66 rgb(204,204,102)
        46: (204,204, 51) #CCCC33 rgb(204,204,51)
        47: (204,204,  0) #CCCC00 rgb(204,204,0)
        48: (204,153,255) #CC99FF rgb(204,153,255)
        49: (204,153,204) #CC99CC rgb(204,153,204)
        50: (204,153,153) #CC9999 rgb(204,153,153)
        51: (204,153,102) #CC9966 rgb(204,153,102)
        52: (204,153, 51) #CC9933 rgb(204,153,51)
        53: (204,153,  0) #CC9900 rgb(204,153,0)
        54: (204,102,255) #CC66FF rgb(204,102,255)
        55: (204,102,204) #CC66CC rgb(204,102,204)
        56: (204,102,153) #CC6699 rgb(204,102,153)
        57: (204,102,102) #CC6666 rgb(204,102,102)
        58: (204,102, 51) #CC6633 rgb(204,102,51)
        59: (204,102,  0) #CC6600 rgb(204,102,0)
        60: (204, 51,255) #CC33FF rgb(204,51,255)
        61: (204, 51,204) #CC33CC rgb(204,51,204)
        62: (204, 51,153) #CC3399 rgb(204,51,153)
        63: (204, 51,102) #CC3366 rgb(204,51,102)
        64: (204, 51, 51) #CC3333 rgb(204,51,51)
        65: (204, 51,  0) #CC3300 rgb(204,51,0)
        66: (204,  0,255) #CC00FF rgb(204,0,255)
        67: (204,  0,204) #CC00CC rgb(204,0,204)
        68: (204,  0,153) #CC0099 rgb(204,0,153)
        69: (204,  0,102) #CC0066 rgb(204,0,102)
        70: (204,  0, 51) #CC0033 rgb(204,0,51)
        71: (204,  0,  0) #CC0000 rgb(204,0,0)
        72: (153,255,255) #99FFFF rgb(153,255,255)
        73: (153,255,204) #99FFCC rgb(153,255,204)
        74: (153,255,153) #99FF99 rgb(153,255,153)
        75: (153,255,102) #99FF66 rgb(153,255,102)
        76: (153,255, 51) #99FF33 rgb(153,255,51)
        77: (153,255,  0) #99FF00 rgb(153,255,0)
        78: (153,204,255) #99CCFF rgb(153,204,255)
        79: (153,204,204) #99CCCC rgb(153,204,204)
        80: (153,204,153) #99CC99 rgb(153,204,153)
        81: (153,204,102) #99CC66 rgb(153,204,102)
        82: (153,204, 51) #99CC33 rgb(153,204,51)
        83: (153,204,  0) #99CC00 rgb(153,204,0)
        84: (153,153,255) #9999FF rgb(153,153,255)
        85: (153,153,204) #9999CC rgb(153,153,204)
        86: (153,153,153) #999999 grey60
        87: (153,153,102) #999966 rgb(153,153,102)
        88: (153,153, 51) #999933 rgb(153,153,51)
        89: (153,153,  0) #999900 rgb(153,153,0)
        90: (153,102,255) #9966FF rgb(153,102,255)
        91: (153,102,204) #9966CC rgb(153,102,204)
        92: (153,102,153) #996699 rgb(153,102,153)
        93: (153,102,102) #996666 rgb(153,102,102)
        94: (153,102, 51) #996633 rgb(153,102,51)
        95: (153,102,  0) #996600 rgb(153,102,0)
        96: (153, 51,255) #9933FF rgb(153,51,255)
        97: (153, 51,204) #9933CC rgb(153,51,204)
        98: (153, 51,153) #993399 rgb(153,51,153)
        99: (153, 51,102) #993366 rgb(153,51,102)
       100: (153, 51, 51) #993333 rgb(153,51,51)
       101: (153, 51,  0) #993300 rgb(153,51,0)
       102: (153,  0,255) #9900FF rgb(153,0,255)
       103: (153,  0,204) #9900CC rgb(153,0,204)
       104: (153,  0,153) #990099 rgb(153,0,153)
       105: (153,  0,102) #990066 rgb(153,0,102)
       106: (153,  0, 51) #990033 rgb(153,0,51)
       107: (153,  0,  0) #990000 rgb(153,0,0)
       108: (102,255,255) #66FFFF rgb(102,255,255)
       109: (102,255,204) #66FFCC rgb(102,255,204)
       110: (102,255,153) #66FF99 rgb(102,255,153)
       111: (102,255,102) #66FF66 rgb(102,255,102)
       112: (102,255, 51) #66FF33 rgb(102,255,51)
       113: (102,255,  0) #66FF00 rgb(102,255,0)
       114: (102,204,255) #66CCFF rgb(102,204,255)
       115: (102,204,204) #66CCCC rgb(102,204,204)
       116: (102,204,153) #66CC99 rgb(102,204,153)
       117: (102,204,102) #66CC66 rgb(102,204,102)
       118: (102,204, 51) #66CC33 rgb(102,204,51)
       119: (102,204,  0) #66CC00 rgb(102,204,0)
       120: (102,153,255) #6699FF rgb(102,153,255)
       121: (102,153,204) #6699CC rgb(102,153,204)
       122: (102,153,153) #669999 rgb(102,153,153)
       123: (102,153,102) #669966 rgb(102,153,102)
       124: (102,153, 51) #669933 rgb(102,153,51)
       125: (102,153,  0) #669900 rgb(102,153,0)
       126: (102,102,255) #6666FF rgb(102,102,255)
       127: (102,102,204) #6666CC rgb(102,102,204)
       128: (102,102,153) #666699 rgb(102,102,153)
       129: (102,102,102) #666666 grey40
       130: (102,102, 51) #666633 rgb(102,102,51)
       131: (102,102,  0) #666600 rgb(102,102,0)
       132: (102, 51,255) #6633FF rgb(102,51,255)
       133: (102, 51,204) #6633CC rgb(102,51,204)
       134: (102, 51,153) #663399 rgb(102,51,153)
       135: (102, 51,102) #663366 rgb(102,51,102)
       136: (102, 51, 51) #663333 rgb(102,51,51)
       137: (102, 51,  0) #663300 rgb(102,51,0)
       138: (102,  0,255) #6600FF rgb(102,0,255)
       139: (102,  0,204) #6600CC rgb(102,0,204)
       140: (102,  0,153) #660099 rgb(102,0,153)
       141: (102,  0,102) #660066 rgb(102,0,102)
       142: (102,  0, 51) #660033 rgb(102,0,51)
       143: (102,  0,  0) #660000 rgb(102,0,0)
       144: ( 51,255,255) #33FFFF rgb(51,255,255)
       145: ( 51,255,204) #33FFCC rgb(51,255,204)
       146: ( 51,255,153) #33FF99 rgb(51,255,153)
       147: ( 51,255,102) #33FF66 rgb(51,255,102)
       148: ( 51,255, 51) #33FF33 rgb(51,255,51)
       149: ( 51,255,  0) #33FF00 rgb(51,255,0)
       150: ( 51,204,255) #33CCFF rgb(51,204,255)
       151: ( 51,204,204) #33CCCC rgb(51,204,204)
       152: ( 51,204,153) #33CC99 rgb(51,204,153)
       153: ( 51,204,102) #33CC66 rgb(51,204,102)
       154: ( 51,204, 51) #33CC33 rgb(51,204,51)
       155: ( 51,204,  0) #33CC00 rgb(51,204,0)
       156: ( 51,153,255) #3399FF rgb(51,153,255)
       157: ( 51,153,204) #3399CC rgb(51,153,204)
       158: ( 51,153,153) #339999 rgb(51,153,153)
       159: ( 51,153,102) #339966 rgb(51,153,102)
       160: ( 51,153, 51) #339933 rgb(51,153,51)
       161: ( 51,153,  0) #339900 rgb(51,153,0)
       162: ( 51,102,255) #3366FF rgb(51,102,255)
       163: ( 51,102,204) #3366CC rgb(51,102,204)
       164: ( 51,102,153) #336699 rgb(51,102,153)
       165: ( 51,102,102) #336666 rgb(51,102,102)
       166: ( 51,102, 51) #336633 rgb(51,102,51)
       167: ( 51,102,  0) #336600 rgb(51,102,0)
       168: ( 51, 51,255) #3333FF rgb(51,51,255)
       169: ( 51, 51,204) #3333CC rgb(51,51,204)
       170: ( 51, 51,153) #333399 rgb(51,51,153)
       171: ( 51, 51,102) #333366 rgb(51,51,102)
       172: ( 51, 51, 51) #333333 grey20
       173: ( 51, 51,  0) #333300 rgb(51,51,0)
       174: ( 51,  0,255) #3300FF rgb(51,0,255)
       175: ( 51,  0,204) #3300CC rgb(51,0,204)
       176: ( 51,  0,153) #330099 rgb(51,0,153)
       177: ( 51,  0,102) #330066 rgb(51,0,102)
       178: ( 51,  0, 51) #330033 rgb(51,0,51)
       179: ( 51,  0,  0) #330000 rgb(51,0,0)
       180: (  0,255,255) #00FFFF cyan
       181: (  0,255,204) #00FFCC rgb(0,255,204)
       182: (  0,255,153) #00FF99 rgb(0,255,153)
       183: (  0,255,102) #00FF66 rgb(0,255,102)
       184: (  0,255, 51) #00FF33 rgb(0,255,51)
       185: (  0,255,  0) #00FF00 lime
       186: (  0,204,255) #00CCFF rgb(0,204,255)
       187: (  0,204,204) #00CCCC rgb(0,204,204)
       188: (  0,204,153) #00CC99 rgb(0,204,153)
       189: (  0,204,102) #00CC66 rgb(0,204,102)
       190: (  0,204, 51) #00CC33 rgb(0,204,51)
       191: (  0,204,  0) #00CC00 rgb(0,204,0)
       192: (  0,153,255) #0099FF rgb(0,153,255)
       193: (  0,153,204) #0099CC rgb(0,153,204)
       194: (  0,153,153) #009999 rgb(0,153,153)
       195: (  0,153,102) #009966 rgb(0,153,102)
       196: (  0,153, 51) #009933 rgb(0,153,51)
       197: (  0,153,  0) #009900 rgb(0,153,0)
       198: (  0,102,255) #0066FF rgb(0,102,255)
       199: (  0,102,204) #0066CC rgb(0,102,204)
       200: (  0,102,153) #006699 rgb(0,102,153)
       201: (  0,102,102) #006666 rgb(0,102,102)
       202: (  0,102, 51) #006633 rgb(0,102,51)
       203: (  0,102,  0) #006600 rgb(0,102,0)
       204: (  0, 51,255) #0033FF rgb(0,51,255)
       205: (  0, 51,204) #0033CC rgb(0,51,204)
       206: (  0, 51,153) #003399 rgb(0,51,153)
       207: (  0, 51,102) #003366 rgb(0,51,102)
       208: (  0, 51, 51) #003333 rgb(0,51,51)
       209: (  0, 51,  0) #003300 rgb(0,51,0)
       210: (  0,  0,255) #0000FF blue
       211: (  0,  0,204) #0000CC rgb(0,0,204)
       212: (  0,  0,153) #000099 rgb(0,0,153)
       213: (  0,  0,102) #000066 rgb(0,0,102)
       214: (  0,  0, 51) #000033 rgb(0,0,51)
       215: (  0,  0,  0) #000000 black
       216: (255,255,255) #FFFFFF white
       217: (255,255,255) #FFFFFF white
       218: (255,255,255) #FFFFFF white
       219: (255,255,255) #FFFFFF white
       220: (255,255,255) #FFFFFF white
       221: (255,255,255) #FFFFFF white
       222: (255,255,255) #FFFFFF white
       223: (255,255,255) #FFFFFF white
       224: (255,255,255) #FFFFFF white
       225: (255,255,255) #FFFFFF white
       226: (255,255,255) #FFFFFF white
       227: (255,255,255) #FFFFFF white
       228: (255,255,255) #FFFFFF white
       229: (255,255,255) #FFFFFF white
       230: (255,255,255) #FFFFFF white
       231: (255,255,255) #FFFFFF white
       232: (255,255,255) #FFFFFF white
       233: (255,255,255) #FFFFFF white
       234: (255,255,255) #FFFFFF white
       235: (255,255,255) #FFFFFF white
       236: (255,255,255) #FFFFFF white
       237: (255,255,255) #FFFFFF white
       238: (255,255,255) #FFFFFF white
       239: (255,255,255) #FFFFFF white
       240: (255,255,255) #FFFFFF white
       241: (255,255,255) #FFFFFF white
       242: (255,255,255) #FFFFFF white
       243: (255,255,255) #FFFFFF white
       244: (255,255,255) #FFFFFF white
       245: (255,255,255) #FFFFFF white
       246: (255,255,255) #FFFFFF white
       247: (255,255,255) #FFFFFF white
       248: (255,255,255) #FFFFFF white
       249: (255,255,255) #FFFFFF white
       250: (255,255,255) #FFFFFF white
       251: (255,255,255) #FFFFFF white
       252: (255,255,255) #FFFFFF white
       253: (255,255,255) #FFFFFF white
       254: (255,255,255) #FFFFFF white
       255: (255,255,255) #FFFFFF white
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 100x100+0+0
  Dispose: Undefined
  Delay: 10x100
  Iterations: 0
  Scene: 0 of 2
  Compression: LZW
  Orientation: Undefined
  Properties:
    date:create: 2012-06-30T18:30:24+01:00
    date:modify: 2012-06-30T18:32:36+01:00
    signature: 3755862355e2e7d0e0dc0f6b98a89978c0710890982862dd17975829e35be6b4
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 1.17KBB
  Number pixels: 10KB
  Pixels per second: 100TB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.7.1-0 2011-07-06 Q16 http://www.imagemagick.org
Image: square1.gif
  Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 100x100+0+0
  Resolution: 72x72
  Print size: 1.38889x1.38889
  Units: Undefined
  Type: Bilevel
  Base type: Bilevel
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8/4-bit
  Channel depth:
    gray: 1-bit
  Channel statistics:
    Gray:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
     10000: (255,255,255) #FFFFFF white
  Colormap: 256
         0: (255,255,255) #FFFFFF white
         1: (255,255,204) #FFFFCC rgb(255,255,204)
         2: (255,255,153) #FFFF99 rgb(255,255,153)
         3: (255,255,102) #FFFF66 rgb(255,255,102)
         4: (255,255, 51) #FFFF33 rgb(255,255,51)
         5: (255,255,  0) #FFFF00 yellow
         6: (255,204,255) #FFCCFF rgb(255,204,255)
         7: (255,204,204) #FFCCCC rgb(255,204,204)
         8: (255,204,153) #FFCC99 rgb(255,204,153)
         9: (255,204,102) #FFCC66 rgb(255,204,102)
        10: (255,204, 51) #FFCC33 rgb(255,204,51)
        11: (255,204,  0) #FFCC00 rgb(255,204,0)
        12: (255,153,255) #FF99FF rgb(255,153,255)
        13: (255,153,204) #FF99CC rgb(255,153,204)
        14: (255,153,153) #FF9999 rgb(255,153,153)
        15: (255,153,102) #FF9966 rgb(255,153,102)
        16: (255,153, 51) #FF9933 rgb(255,153,51)
        17: (255,153,  0) #FF9900 rgb(255,153,0)
        18: (255,102,255) #FF66FF rgb(255,102,255)
        19: (255,102,204) #FF66CC rgb(255,102,204)
        20: (255,102,153) #FF6699 rgb(255,102,153)
        21: (255,102,102) #FF6666 rgb(255,102,102)
        22: (255,102, 51) #FF6633 rgb(255,102,51)
        23: (255,102,  0) #FF6600 rgb(255,102,0)
        24: (255, 51,255) #FF33FF rgb(255,51,255)
        25: (255, 51,204) #FF33CC rgb(255,51,204)
        26: (255, 51,153) #FF3399 rgb(255,51,153)
        27: (255, 51,102) #FF3366 rgb(255,51,102)
        28: (255, 51, 51) #FF3333 rgb(255,51,51)
        29: (255, 51,  0) #FF3300 rgb(255,51,0)
        30: (255,  0,255) #FF00FF magenta
        31: (255,  0,204) #FF00CC rgb(255,0,204)
        32: (255,  0,153) #FF0099 rgb(255,0,153)
        33: (255,  0,102) #FF0066 rgb(255,0,102)
        34: (255,  0, 51) #FF0033 rgb(255,0,51)
        35: (255,  0,  0) #FF0000 red
        36: (204,255,255) #CCFFFF rgb(204,255,255)
        37: (204,255,204) #CCFFCC rgb(204,255,204)
        38: (204,255,153) #CCFF99 rgb(204,255,153)
        39: (204,255,102) #CCFF66 rgb(204,255,102)
        40: (204,255, 51) #CCFF33 rgb(204,255,51)
        41: (204,255,  0) #CCFF00 rgb(204,255,0)
        42: (204,204,255) #CCCCFF rgb(204,204,255)
        43: (204,204,204) #CCCCCC grey80
        44: (204,204,153) #CCCC99 rgb(204,204,153)
        45: (204,204,102) #CCCC66 rgb(204,204,102)
        46: (204,204, 51) #CCCC33 rgb(204,204,51)
        47: (204,204,  0) #CCCC00 rgb(204,204,0)
        48: (204,153,255) #CC99FF rgb(204,153,255)
        49: (204,153,204) #CC99CC rgb(204,153,204)
        50: (204,153,153) #CC9999 rgb(204,153,153)
        51: (204,153,102) #CC9966 rgb(204,153,102)
        52: (204,153, 51) #CC9933 rgb(204,153,51)
        53: (204,153,  0) #CC9900 rgb(204,153,0)
        54: (204,102,255) #CC66FF rgb(204,102,255)
        55: (204,102,204) #CC66CC rgb(204,102,204)
        56: (204,102,153) #CC6699 rgb(204,102,153)
        57: (204,102,102) #CC6666 rgb(204,102,102)
        58: (204,102, 51) #CC6633 rgb(204,102,51)
        59: (204,102,  0) #CC6600 rgb(204,102,0)
        60: (204, 51,255) #CC33FF rgb(204,51,255)
        61: (204, 51,204) #CC33CC rgb(204,51,204)
        62: (204, 51,153) #CC3399 rgb(204,51,153)
        63: (204, 51,102) #CC3366 rgb(204,51,102)
        64: (204, 51, 51) #CC3333 rgb(204,51,51)
        65: (204, 51,  0) #CC3300 rgb(204,51,0)
        66: (204,  0,255) #CC00FF rgb(204,0,255)
        67: (204,  0,204) #CC00CC rgb(204,0,204)
        68: (204,  0,153) #CC0099 rgb(204,0,153)
        69: (204,  0,102) #CC0066 rgb(204,0,102)
        70: (204,  0, 51) #CC0033 rgb(204,0,51)
        71: (204,  0,  0) #CC0000 rgb(204,0,0)
        72: (153,255,255) #99FFFF rgb(153,255,255)
        73: (153,255,204) #99FFCC rgb(153,255,204)
        74: (153,255,153) #99FF99 rgb(153,255,153)
        75: (153,255,102) #99FF66 rgb(153,255,102)
        76: (153,255, 51) #99FF33 rgb(153,255,51)
        77: (153,255,  0) #99FF00 rgb(153,255,0)
        78: (153,204,255) #99CCFF rgb(153,204,255)
        79: (153,204,204) #99CCCC rgb(153,204,204)
        80: (153,204,153) #99CC99 rgb(153,204,153)
        81: (153,204,102) #99CC66 rgb(153,204,102)
        82: (153,204, 51) #99CC33 rgb(153,204,51)
        83: (153,204,  0) #99CC00 rgb(153,204,0)
        84: (153,153,255) #9999FF rgb(153,153,255)
        85: (153,153,204) #9999CC rgb(153,153,204)
        86: (153,153,153) #999999 grey60
        87: (153,153,102) #999966 rgb(153,153,102)
        88: (153,153, 51) #999933 rgb(153,153,51)
        89: (153,153,  0) #999900 rgb(153,153,0)
        90: (153,102,255) #9966FF rgb(153,102,255)
        91: (153,102,204) #9966CC rgb(153,102,204)
        92: (153,102,153) #996699 rgb(153,102,153)
        93: (153,102,102) #996666 rgb(153,102,102)
        94: (153,102, 51) #996633 rgb(153,102,51)
        95: (153,102,  0) #996600 rgb(153,102,0)
        96: (153, 51,255) #9933FF rgb(153,51,255)
        97: (153, 51,204) #9933CC rgb(153,51,204)
        98: (153, 51,153) #993399 rgb(153,51,153)
        99: (153, 51,102) #993366 rgb(153,51,102)
       100: (153, 51, 51) #993333 rgb(153,51,51)
       101: (153, 51,  0) #993300 rgb(153,51,0)
       102: (153,  0,255) #9900FF rgb(153,0,255)
       103: (153,  0,204) #9900CC rgb(153,0,204)
       104: (153,  0,153) #990099 rgb(153,0,153)
       105: (153,  0,102) #990066 rgb(153,0,102)
       106: (153,  0, 51) #990033 rgb(153,0,51)
       107: (153,  0,  0) #990000 rgb(153,0,0)
       108: (102,255,255) #66FFFF rgb(102,255,255)
       109: (102,255,204) #66FFCC rgb(102,255,204)
       110: (102,255,153) #66FF99 rgb(102,255,153)
       111: (102,255,102) #66FF66 rgb(102,255,102)
       112: (102,255, 51) #66FF33 rgb(102,255,51)
       113: (102,255,  0) #66FF00 rgb(102,255,0)
       114: (102,204,255) #66CCFF rgb(102,204,255)
       115: (102,204,204) #66CCCC rgb(102,204,204)
       116: (102,204,153) #66CC99 rgb(102,204,153)
       117: (102,204,102) #66CC66 rgb(102,204,102)
       118: (102,204, 51) #66CC33 rgb(102,204,51)
       119: (102,204,  0) #66CC00 rgb(102,204,0)
       120: (102,153,255) #6699FF rgb(102,153,255)
       121: (102,153,204) #6699CC rgb(102,153,204)
       122: (102,153,153) #669999 rgb(102,153,153)
       123: (102,153,102) #669966 rgb(102,153,102)
       124: (102,153, 51) #669933 rgb(102,153,51)
       125: (102,153,  0) #669900 rgb(102,153,0)
       126: (102,102,255) #6666FF rgb(102,102,255)
       127: (102,102,204) #6666CC rgb(102,102,204)
       128: (102,102,153) #666699 rgb(102,102,153)
       129: (102,102,102) #666666 grey40
       130: (102,102, 51) #666633 rgb(102,102,51)
       131: (102,102,  0) #666600 rgb(102,102,0)
       132: (102, 51,255) #6633FF rgb(102,51,255)
       133: (102, 51,204) #6633CC rgb(102,51,204)
       134: (102, 51,153) #663399 rgb(102,51,153)
       135: (102, 51,102) #663366 rgb(102,51,102)
       136: (102, 51, 51) #663333 rgb(102,51,51)
       137: (102, 51,  0) #663300 rgb(102,51,0)
       138: (102,  0,255) #6600FF rgb(102,0,255)
       139: (102,  0,204) #6600CC rgb(102,0,204)
       140: (102,  0,153) #660099 rgb(102,0,153)
       141: (102,  0,102) #660066 rgb(102,0,102)
       142: (102,  0, 51) #660033 rgb(102,0,51)
       143: (102,  0,  0) #660000 rgb(102,0,0)
       144: ( 51,255,255) #33FFFF rgb(51,255,255)
       145: ( 51,255,204) #33FFCC rgb(51,255,204)
       146: ( 51,255,153) #33FF99 rgb(51,255,153)
       147: ( 51,255,102) #33FF66 rgb(51,255,102)
       148: ( 51,255, 51) #33FF33 rgb(51,255,51)
       149: ( 51,255,  0) #33FF00 rgb(51,255,0)
       150: ( 51,204,255) #33CCFF rgb(51,204,255)
       151: ( 51,204,204) #33CCCC rgb(51,204,204)
       152: ( 51,204,153) #33CC99 rgb(51,204,153)
       153: ( 51,204,102) #33CC66 rgb(51,204,102)
       154: ( 51,204, 51) #33CC33 rgb(51,204,51)
       155: ( 51,204,  0) #33CC00 rgb(51,204,0)
       156: ( 51,153,255) #3399FF rgb(51,153,255)
       157: ( 51,153,204) #3399CC rgb(51,153,204)
       158: ( 51,153,153) #339999 rgb(51,153,153)
       159: ( 51,153,102) #339966 rgb(51,153,102)
       160: ( 51,153, 51) #339933 rgb(51,153,51)
       161: ( 51,153,  0) #339900 rgb(51,153,0)
       162: ( 51,102,255) #3366FF rgb(51,102,255)
       163: ( 51,102,204) #3366CC rgb(51,102,204)
       164: ( 51,102,153) #336699 rgb(51,102,153)
       165: ( 51,102,102) #336666 rgb(51,102,102)
       166: ( 51,102, 51) #336633 rgb(51,102,51)
       167: ( 51,102,  0) #336600 rgb(51,102,0)
       168: ( 51, 51,255) #3333FF rgb(51,51,255)
       169: ( 51, 51,204) #3333CC rgb(51,51,204)
       170: ( 51, 51,153) #333399 rgb(51,51,153)
       171: ( 51, 51,102) #333366 rgb(51,51,102)
       172: ( 51, 51, 51) #333333 grey20
       173: ( 51, 51,  0) #333300 rgb(51,51,0)
       174: ( 51,  0,255) #3300FF rgb(51,0,255)
       175: ( 51,  0,204) #3300CC rgb(51,0,204)
       176: ( 51,  0,153) #330099 rgb(51,0,153)
       177: ( 51,  0,102) #330066 rgb(51,0,102)
       178: ( 51,  0, 51) #330033 rgb(51,0,51)
       179: ( 51,  0,  0) #330000 rgb(51,0,0)
       180: (  0,255,255) #00FFFF cyan
       181: (  0,255,204) #00FFCC rgb(0,255,204)
       182: (  0,255,153) #00FF99 rgb(0,255,153)
       183: (  0,255,102) #00FF66 rgb(0,255,102)
       184: (  0,255, 51) #00FF33 rgb(0,255,51)
       185: (  0,255,  0) #00FF00 lime
       186: (  0,204,255) #00CCFF rgb(0,204,255)
       187: (  0,204,204) #00CCCC rgb(0,204,204)
       188: (  0,204,153) #00CC99 rgb(0,204,153)
       189: (  0,204,102) #00CC66 rgb(0,204,102)
       190: (  0,204, 51) #00CC33 rgb(0,204,51)
       191: (  0,204,  0) #00CC00 rgb(0,204,0)
       192: (  0,153,255) #0099FF rgb(0,153,255)
       193: (  0,153,204) #0099CC rgb(0,153,204)
       194: (  0,153,153) #009999 rgb(0,153,153)
       195: (  0,153,102) #009966 rgb(0,153,102)
       196: (  0,153, 51) #009933 rgb(0,153,51)
       197: (  0,153,  0) #009900 rgb(0,153,0)
       198: (  0,102,255) #0066FF rgb(0,102,255)
       199: (  0,102,204) #0066CC rgb(0,102,204)
       200: (  0,102,153) #006699 rgb(0,102,153)
       201: (  0,102,102) #006666 rgb(0,102,102)
       202: (  0,102, 51) #006633 rgb(0,102,51)
       203: (  0,102,  0) #006600 rgb(0,102,0)
       204: (  0, 51,255) #0033FF rgb(0,51,255)
       205: (  0, 51,204) #0033CC rgb(0,51,204)
       206: (  0, 51,153) #003399 rgb(0,51,153)
       207: (  0, 51,102) #003366 rgb(0,51,102)
       208: (  0, 51, 51) #003333 rgb(0,51,51)
       209: (  0, 51,  0) #003300 rgb(0,51,0)
       210: (  0,  0,255) #0000FF blue
       211: (  0,  0,204) #0000CC rgb(0,0,204)
       212: (  0,  0,153) #000099 rgb(0,0,153)
       213: (  0,  0,102) #000066 rgb(0,0,102)
       214: (  0,  0, 51) #000033 rgb(0,0,51)
       215: (  0,  0,  0) #000000 black
       216: (255,255,255) #FFFFFF white
       217: (255,255,255) #FFFFFF white
       218: (255,255,255) #FFFFFF white
       219: (255,255,255) #FFFFFF white
       220: (255,255,255) #FFFFFF white
       221: (255,255,255) #FFFFFF white
       222: (255,255,255) #FFFFFF white
       223: (255,255,255) #FFFFFF white
       224: (255,255,255) #FFFFFF white
       225: (255,255,255) #FFFFFF white
       226: (255,255,255) #FFFFFF white
       227: (255,255,255) #FFFFFF white
       228: (255,255,255) #FFFFFF white
       229: (255,255,255) #FFFFFF white
       230: (255,255,255) #FFFFFF white
       231: (255,255,255) #FFFFFF white
       232: (255,255,255) #FFFFFF white
       233: (255,255,255) #FFFFFF white
       234: (255,255,255) #FFFFFF white
       235: (255,255,255) #FFFFFF white
       236: (255,255,255) #FFFFFF white
       237: (255,255,255) #FFFFFF white
       238: (255,255,255) #FFFFFF white
       239: (255,255,255) #FFFFFF white
       240: (255,255,255) #FFFFFF white
       241: (255,255,255) #FFFFFF white
       242: (255,255,255) #FFFFFF white
       243: (255,255,255) #FFFFFF white
       244: (255,255,255) #FFFFFF white
       245: (255,255,255) #FFFFFF white
       246: (255,255,255) #FFFFFF white
       247: (255,255,255) #FFFFFF white
       248: (255,255,255) #FFFFFF white
       249: (255,255,255) #FFFFFF white
       250: (255,255,255) #FFFFFF white
       251: (255,255,255) #FFFFFF white
       252: (255,255,255) #FFFFFF white
       253: (255,255,255) #FFFFFF white
       254: (255,255,255) #FFFFFF white
       255: (255,255,255) #FFFFFF white
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 100x100+0+0
  Dispose: Undefined
  Delay: 10x100
  Scene: 1 of 2
  Compression: LZW
  Orientation: Undefined
  Properties:
    date:create: 2012-06-30T18:30:24+01:00
    date:modify: 2012-06-30T18:32:36+01:00
    signature: 1977958db19dc7cb8a327c98f8d3c0f338feda83395563ba18d6285ab98cd1c2
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 1.17KBB
  Number pixels: 10KB
  Pixels per second: 128KB
  User time: 0.078u
  Elapsed time: 0:01.078
  Version: ImageMagick 6.7.1-0 2011-07-06 Q16 http://www.imagemagick.org

Code: Select all

Image: square2.gif
  Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 100x100+0+0
  Resolution: 72x72
  Print size: 1.38889x1.38889
  Units: Undefined
  Type: Bilevel
  Base type: Bilevel
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8/1-bit
  Channel depth:
    gray: 1-bit
  Channel statistics:
    Gray:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
     10000: (  0,  0,  0) #000000 black
  Colormap: 2
         0: (  0,  0,  0) #000000 black
         1: (  0,  0,  0) #000000 black
  Rendering intent: Undefined
  Interlace: None
  Background color: black
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 100x100+0+0
  Dispose: Undefined
  Delay: 10x100
  Iterations: 0
  Scene: 0 of 2
  Compression: LZW
  Orientation: Undefined
  Properties:
    date:create: 2012-06-30T18:30:24+01:00
    date:modify: 2012-06-30T18:33:04+01:00
    signature: 3755862355e2e7d0e0dc0f6b98a89978c0710890982862dd17975829e35be6b4
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 317BB
  Number pixels: 10KB
  Pixels per second: 100TB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.7.1-0 2011-07-06 Q16 http://www.imagemagick.org
Image: square2.gif
  Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 100x100+0+0
  Resolution: 72x72
  Print size: 1.38889x1.38889
  Units: Undefined
  Type: Bilevel
  Base type: Bilevel
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8/1-bit
  Channel depth:
    gray: 1-bit
  Channel statistics:
    Gray:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
     10000: (255,255,255) #FFFFFF white
  Colormap: 2
         0: (255,255,255) #FFFFFF white
         1: (  0,  0,  0) #000000 black
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 100x100+0+0
  Dispose: Undefined
  Delay: 10x100
  Scene: 1 of 2
  Compression: LZW
  Orientation: Undefined
  Properties:
    date:create: 2012-06-30T18:30:24+01:00
    date:modify: 2012-06-30T18:33:04+01:00
    signature: 1977958db19dc7cb8a327c98f8d3c0f338feda83395563ba18d6285ab98cd1c2
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 317BB
  Number pixels: 10KB
  Pixels per second: 159KB
  User time: 0.047u
  Elapsed time: 0:01.062
  Version: ImageMagick 6.7.1-0 2011-07-06 Q16 http://www.imagemagick.org

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T13:00:54-07:00
by jverne
BTW, I know the color palettes have at maximum 256 colors and that's the point. convert -colors 256 can be used to simply and always optimize gifs (i.e. remove unused or repeated colors from color palettes).

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T13:48:34-07:00
by fmw42
Your gif is a two-frame animation. Each frame has only one color (black or white). So to reset the colormap

convert square1.gif -coalesce -colors 1 square2.gif

Code: Select all

Image: square2.gif
  Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 100x100+0+0
  Resolution: 72x72
  Print size: 1.38889x1.38889
  Units: Undefined
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8/1-bit
  Channel depth:
    red: 1-bit
    green: 1-bit
    blue: 1-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Green:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Blue:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Image statistics:
    Overall:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
     10000: (  0,  0,  0) #000000 black
  Colormap: 2
         0: (  0,  0,  0) #000000 black
         1: (  0,  0,  0) #000000 black
  Rendering intent: Perceptual
  Gamma: 0.454545
  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: black
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 100x100+0+0
  Dispose: None
  Delay: 10x100
  Iterations: 0
  Scene: 0 of 2
  Compression: LZW
  Orientation: Undefined
  Properties:
    date:create: 2012-06-30T13:46:25-07:00
    date:modify: 2012-06-30T13:46:25-07:00
    signature: 3755862355e2e7d0e0dc0f6b98a89978c0710890982862dd17975829e35be6b4
  Artifacts:
    filename: square2.gif
    verbose: true
  Tainted: False
  Filesize: 317B
  Number pixels: 10K
  Pixels per second: 0B
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.7.7-10 2012-06-28 Q16 http://www.imagemagick.org
Image: square2.gif
  Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 100x100+0+0
  Resolution: 72x72
  Print size: 1.38889x1.38889
  Units: Undefined
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8/1-bit
  Channel depth:
    red: 1-bit
    green: 1-bit
    blue: 1-bit
  Channel statistics:
    Red:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Green:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Blue:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Image statistics:
    Overall:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
     10000: (255,255,255) #FFFFFF white
  Colormap: 2
         0: (255,255,255) #FFFFFF white
         1: (  0,  0,  0) #000000 black
  Rendering intent: Perceptual
  Gamma: 0.454545
  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: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 100x100+0+0
  Dispose: None
  Delay: 10x100
  Scene: 1 of 2
  Compression: LZW
  Orientation: Undefined
  Properties:
    date:create: 2012-06-30T13:46:25-07:00
    date:modify: 2012-06-30T13:46:25-07:00
    signature: 1977958db19dc7cb8a327c98f8d3c0f338feda83395563ba18d6285ab98cd1c2
  Artifacts:
    filename: square2.gif
    verbose: true
  Tainted: False
  Filesize: 317B
  Number pixels: 10K
  Pixels per second: 1MB
  User time: 0.000u
  Elapsed time: 0:01.009
  Version: ImageMagick 6.7.7-10 2012-06-28 Q16 http://www.imagemagick.org

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T14:20:13-07:00
by jverne
fmw42 wrote:Your gif is a two-frame animation. Each frame has only one color (black or white). So to reset the colormap

convert square1.gif -coalesce -colors 1 square2.gif
Yes, I know. I was constructed to prove that convert -colors 256 is not following what is specified in the FAQ (cf. http://www.imagemagick.org/script/comma ... php#colors):
The actual number of colors in the image may be less than your request, but never more. Note that this a color reduction option. Images with fewer unique colors than specified by value will have any duplicate or unused colors removed. The ordering of an existing color palette may be altered. When converting an image from color to grayscale, it is more efficient to convert the image to the gray colorspace before reducing the number of colors.
because, by construction, color palettes have at maximum 256 colors, so the underlined action must always occur. As the aforementioned command is not working, the above specification is violated.

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T15:07:33-07:00
by fmw42
But my point is that your gif image color table is inconsistent with the colors in the image.

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T17:22:43-07:00
by jverne
Ok. Are there any plans of implementing what it is said on the manual or not?

I can live with whatever is decided. Thank you for your time and attention.

Re: IM 6.7.1 Q16 / Win XP / convert -colors 256

Posted: 2012-06-30T19:56:51-07:00
by fmw42
jverne wrote:Ok. Are there any plans of implementing what it is said on the manual or not?

I can live with whatever is decided. Thank you for your time and attention.
I do not know if it is a bug or misunderstand on your part. I do not understand the color reduction algorithm.

This is really a question that the IM developers will have to respond to.