Page 1 of 1
How do I invert the colormap (1bpp bmp)?
Posted: 2011-09-16T07:29:04-07:00
by gohanman
I'm trying to convert 8bpp bitmaps to 1bpp for use with a receipt printer. I can get the correct depth thusly:
Code: Select all
convert -monochrome -colors 2 -depth 1 source.bmp out.bmp
However, this gives me a colormap where 0 => black and 1 => white. The printer, stupidly, ignores the palette in the file and assumes 1 is black. Is there any way to either invert the colormap in the 1bpp file, or explicitly define the colormap during conversion from 8bpp to 1bpp?
Re: How do I invert the colormap (1bpp bmp)?
Posted: 2011-09-16T10:18:21-07:00
by fmw42
What about just inverting the colors?
convert -monochrome -colors 2 -depth 1 -negate source.bmp out.bmp
Re: How do I invert the colormap (1bpp bmp)?
Posted: 2011-09-16T10:58:28-07:00
by gohanman
Negate actually inverts the colormap as well as the pixels - so the print out doesn't change, unfortunately. I want to switch just the pixels OR just the colormap, not both.
Re: How do I invert the colormap (1bpp bmp)?
Posted: 2011-09-16T11:07:44-07:00
by fmw42
try converting to tiff, then set the min is white or black flag to swap that and then convert to bmp. see
http://www.imagemagick.org/Usage/formats/#tiff
toggle the photometric interpretation (Added IM 6.3.2-10)
-define quantum:polarity=min-is-black
-define quantum:polarity=min-is-white
Also note that proper IM 6 syntax generally has the input image right after convert, except for things like controls for vector to raster format, such a colorspace and density. see
http://www.imagemagick.org/Usage/basics/#why
Re: How do I invert the colormap (1bpp bmp)?
Posted: 2012-05-01T08:48:48-07:00
by nerdx86
Are you using a foxjet or similar monochrome printhead?
I played with this and I found that -remap test.bmp, where test.bmp has the right palette works well..