Page 1 of 1

convert -modulate fail sometimes with xpm files

Posted: 2013-03-19T02:11:26-07:00
by cedric
With imagemagick v6.8.2 when I try to convert the file below with this command :

Code: Select all

convert test.xpm -modulate 100,100,150 test_out.xpm
things go (quite) I’ve expected. Quite expected because colors are also converted in Hexa 16...

Code: Select all

/* XPM */
static char *test[] = {
"16 16 4 1",
" 	c None",
". c #729FCF",
"+ c #6194CB",
"@ c #3465A4",
"++++++++++++++++",
"++++++++++++++++",
"++++++++++++++++",
"++++++++++++++++",
"................",
"................",
"................",
"................",
"................",
"................",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"                "
};
BUT with a file without color 'none' like the file below
the colors remain the same.

Code: Select all

/* XPM */
static char *test[] = {
"16 16 3 1",
". c #729FCF",
"+ c #6194CB",
"@ c #3465A4",
"++++++++++++++++",
"++++++++++++++++",
"++++++++++++++++",
"++++++++++++++++",
"................",
"................",
"................",
"................",
"................",
"................",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@"
};
converted output:

Code: Select all

/* XPM */
static char *test_out[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1 ",
"  c #72729F9FCFCF",
". c #61619494CBCB",
"X c #34346565A4A4",
/* pixels */
"................",
"................",
"................",
"................",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX"
};
As you can see, colors have not moved (but converted in Hexa 16)

It’s a bug?

Thanks for your answer,

Sorry for my poor English

Re: convert -modulate fail sometimes with xpm files

Posted: 2013-03-21T19:22:39-07:00
by anthony
your IM is a Q16. to get 8 bit color output use -depth 8 before the output filename.