Search code examples
imageencodingbinaryrun-length-encoding

1-bit RLE (Run Length Encoding) of B/W Image


I want to build a custom 3D slicer for the Anycubic Photon printer. For this I need to encode each slice (image) data in 1-bit RLE format. Looking at the files which are produced by Anycubics slicers I see that groups of black pixels have HEX value 0x7D.

As I understand the encoding of 1-bit RLE, the first bit of each byte is the color and the other 7 bits are the number of folowing pixels which have the samen color. I would expect a set of 127 black pixels to have binary value of b01111111 and hex value of 0x7F (127). Can anyone tell me what I am doing wrong?


Solution

  • I figured it out. I expected the Photon Slicer to group the maximum number of pixels with the same color and thus for 127 pixels would use the binary value b 0111 1111. As it turns out the Photon slicer maximizes each groupsize to a lower value (hence b 0111 1101). Don't know why the Photon slicer does this, but using standard decoding I can extract the image correctly.