I want to read pgm file. I kept image content in byte array. When I accessed pixels, I see that some values are negative. So, I applied "& 0xFF" each byte. I hope it is ok but when I write to file, it isn't same as original image.
How can i read and write pgm p5 file?
int i = byteArray[index] & 0xFF; //reading
writer.write((char)(i)); //BufferedWriter