H
hierholzer
I'm reading in a JPEG and I get the RGB array via
image.getRGB(...);
I modify the first eight pixels of the RGB array. Specifically,
I modify each pixels lower 4 bits.
The output is the following:
rgb[0] = 11111111111111001111111111110000
rgb[1] = 11111111111111001111111111110000
rgb[2] = 11111111111111111111111111110000
rgb[3] = 11111111111111111111111111110000
rgb[4] = 11111111111111111111111111110000
rgb[5] = 11111111111111111111111111110000
rgb[6] = 11111111111111111111111111110001
rgb[7] = 11111111111111111111111111110100
I used Integer.toBinaryString on each element.
I then use the setRGB method of the Image class:
image.setRGB(...);
So that my new RGB values are saved.
After this, I write out the image data to a new
image; however, after I read in this new image,
the first 8 elements of the RGB array are as
follows:
rgb[0] = 11111111111111101111111111111010
rgb[1] = 11111111111111101111111111111010
rgb[2] = 11111111111111101111111011111100
rgb[3] = 11111111111111101111111011111100
rgb[4] = 11111111111111011111111111111110
rgb[5] = 11111111111111011111111111111110
rgb[6] = 11111111111111011111111111111110
rgb[7] = 11111111111111011111111111111110
Note: I read in a JPEG and write out a JPEG.
Any idea for this discrepancy?
image.getRGB(...);
I modify the first eight pixels of the RGB array. Specifically,
I modify each pixels lower 4 bits.
The output is the following:
rgb[0] = 11111111111111001111111111110000
rgb[1] = 11111111111111001111111111110000
rgb[2] = 11111111111111111111111111110000
rgb[3] = 11111111111111111111111111110000
rgb[4] = 11111111111111111111111111110000
rgb[5] = 11111111111111111111111111110000
rgb[6] = 11111111111111111111111111110001
rgb[7] = 11111111111111111111111111110100
I used Integer.toBinaryString on each element.
I then use the setRGB method of the Image class:
image.setRGB(...);
So that my new RGB values are saved.
After this, I write out the image data to a new
image; however, after I read in this new image,
the first 8 elements of the RGB array are as
follows:
rgb[0] = 11111111111111101111111111111010
rgb[1] = 11111111111111101111111111111010
rgb[2] = 11111111111111101111111011111100
rgb[3] = 11111111111111101111111011111100
rgb[4] = 11111111111111011111111111111110
rgb[5] = 11111111111111011111111111111110
rgb[6] = 11111111111111011111111111111110
rgb[7] = 11111111111111011111111111111110
Note: I read in a JPEG and write out a JPEG.
Any idea for this discrepancy?