Search code examples
imagemagick-convertgraphicsmagickimage-compression

gm convert: Unrecognized units type


I try to compress PNG by GraphicsMagick(1.3.23 Q8), here is the command:

gm convert -units Undefined -type palette -define png:format=png8 src.png dest.png

and it comes with error:

gm convert: Unrecognized units type (Undefined).

"gm convert -help" shows that units type supports PixelsPerInch, PixelsPerCentimeter, or Undefined.

Acctually, I also try ImageMagick(7.0.1-6 Q8 x86_64),and the command following works fine:

convert -units Undefined -type palette -define png:format=png8 src.png dest.png

I am confused about the error.


Solution

  • Use "+units" instead of "-units Undefined" (this works with both ImageMagick and GraphicsMagick). In general, you can use "+option" to turn off most options. The documentation should be clarified.