I need to make a program that can tell me what color a specific pixel (with a specific coordinate) from a BMP has. Even smth as simple as this:
Pixel(0,0): Color Green; Pixel(1,0): Color Blue...
..................................................
Pixel(0,344): Color Magenta etc...
till the end of file.
Actual code would be very helpful.
Go look at the manual and find the getpixel functions.
Maikol: 1. Your code does the same thing as blit() and 2. Your code doesn't even compile.
qwertq: If you really need to find the names of the colours in the bitmap, do the following for each pixel:
1. Read colour with getpixel().
2. Decompose to RGB components with getr(), getg() and getb().
3. Convert to HSV colourspace with rgb_to_hsv().
4. Check the H, S and V components. H's value ranges from 0 to 360, where 0 is red, 120 is green, 240 is blue and 360 is again red. 60 is yellow, 180 is cyan, 300 is purple and so on. So if H is between 15 and 45, you can say the colour is orange. The value of S ranges from 0 to 1. If S is 0 (or very close to 0) you can say the colour is a shade of gray. Which shade depends on the value of V, which ranges from 0 to 1. 0 is black, 1 is white and everything between is gray.
If you don't actually need to put names to the colours, but just want to read integer values for pixels, then follow SonShadowCat's advice to RTFM.