How to convert a binary image data to a jpg file in Java where every 10bits in the binary data represent a pixel?
问题 I am receiving a stream of bits over the Ethernet . I am collecting the bits in a byte[] array in Java (I am collecting them in a byte[] because I think its relevant).The stream is a digitized image where every 10 bits represent a pixel. There are 1280*1024 pixels. Every pixel is represented by 10 bits. Hence, 1280*1024*10 = 13107200 bits = 1638400 bytes is the image size. 回答1: here's the solution - but if the 10 bits represent actually 8 bits with some 'nonsense' in the other two bits its