Page 1 of 1

slicing grayscale into multiple monochrome bitmaps

Posted: 2017-11-10T02:48:27-07:00
by tmalfrere
Hi,

I have a laser system that works with monochrome bitmaps only (0=laser OFF/ 1=laser ON).

Is it possible to convert a grayscale bitmap (eg. 8bit) in to a set of monochrome (255) bitmaps. This way I could do 255 passes with a different bitmap for each pass.
I want to slice a 8bit grayscale into 256 monochrome bitmaps (or the number of different values present in the greyscale bitmap)

An example:
If the value for a bit in the bitmap is 10, this would result in 10 bitmaps with the bit set to 1 and 245 bitmaps with the value set to 0

Does something like this exist? can you do this with imagemagick

Re: slicing grayscale into multiple monochrome bitmaps

Posted: 2017-11-10T03:20:08-07:00
by snibgo
I can see how to slice 8-bit values into 8 slices, but not into 256 slices.

How would you calculate what values to put in the 256 bitmaps? Suppose the input image had a value of 200. Would you put "1" in the first 200 bit maps, then "0" in the other 56?

Re: slicing grayscale into multiple monochrome bitmaps

Posted: 2017-11-13T06:49:39-07:00
by tmalfrere
yes, exactly.

Think of it this way:
The value of a pixel in the bitmap is the number of times you shoot on a pixel with your laser.

Re: slicing grayscale into multiple monochrome bitmaps

Posted: 2017-11-13T07:30:31-07:00
by snibgo
Windows CMD syntax, where in.png is a grayscale image:

Code: Select all

magick in.png -duplicate 255 -threshold %[fx:t*QuantumRange/256] laser-%03d.png
This create outputs laser-000.png, laser-001.png, ... laser-255.png. They all contain pixels that are either black or white. The mean of all all the outputs laser-*.png reproduces in.png.

Depending on your laser device, it might be best if in.png was linear RGB (instead of sRGB), or some other transformation.