Page 1 of 1

xc:color -scale NxM results in xpm output with N*M colors

Posted: 2016-04-01T03:30:03-07:00
by canavan
Creating a monochrome image with xc, scaling it to an arbitrary size and saving as an XPM results in an output file with as many palette / colormap entries as pixels, each used only once in the image. As an example, a 16x16 image scaled from a 1x1 'red' xc: canvas would have 256 colormap entries, all red. A smaller example:

Code: Select all

convert xc:red -scale 2x2 red.xpm
results in:

Code: Select all

/* XPM */
static char *red[] = {
/* columns rows colors chars-per-pixel */
"2 2 4 1 ",
"  c red",
". c red",
"X c red",
"o c red",
/* pixels */
" .",
"Xo"
};

Re: xc:color -scale NxM results in xpm output with N*M colors

Posted: 2016-04-01T04:15:01-07:00
by snibgo
Please, always mention your IM version and platform.

"-scale" isn't relevant. The same behaviour occurs with a sized canvas. IM v6.9.2-5 on Windows 8.1.

Code: Select all

convert -size 2x2 xc:red red.xpm

Code: Select all

/* XPM */
static char *red[] = {
/* columns rows colors chars-per-pixel */
"2 2 4 1 ",
"  c red",
". c red",
"X c red",
"o c red",
/* pixels */
" .",
"Xo"
};

Re: xc:color -scale NxM results in xpm output with N*M colors

Posted: 2016-04-01T04:54:02-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

Re: xc:color -scale NxM results in xpm output with N*M colors

Posted: 2016-04-01T05:27:57-07:00
by canavan
Please, always mention your IM version and platform.
I did build the current release (6.9.3-7) just to verify, the problem exists at least since 6.8.9-9 as shipped with Ubuntu 15.10.

While -scale and -size both produce images that have the problem, an image created with -xc:red[16x16] does not.