I have the following program; it is meant to read a JPG file, create a buffered image of that file, compare each pixel to a cutoff value, and write either a black or white pixel in its place depending on whether it is above or below the cutoff.
It mostly works, except that the pixels it ends up writing appear to be either red or grey.
Clearly there's something about the pixel format I don't understand here. I'd appreciate it if someone could help me figure out what it is.
I am on a Windows system, using msPaint and Windows Picture and Fax Viewer to edit and look at the completed JPGs. I don't *think* those are affecting what I see, but then I don't understand what is happening, either.
After replacing the >< comparisons with <, I ran it and it output a black and white image...when I saved as a PNG. Saving as a JPEG on the other hand...well let's just say that pink and turquoise aren't my favorite colors. It's a transparency problem; it can be fixed by changing this:
Yes, that's a one-character change (not including the changes to get it to compile).
Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
Thanks for the help -- this simple fix solved my immediate problem.
I wish I could find a mid-level tutorial on dealing with graphics at this level; it would be nice to know what the "transparency" issue actually was, instead of just removing the letter to bypass it. If someone can point me to such a beast, I'd appreciate it.