Get Image Pixel
Blitz3D Forums/Blitz3D Programming/Get Image Pixel
Well, i am sure this can be done, but i cannot find how!
I Load an image (loadimage bla bla bla) and i want to get the color of the pixel x,y.
How?
Thanks Masters...
Ohhh, imagebuffer!
Sorry for asking!
Well, another problem:
I have a 256 Color Image (gray scale)
I want to read the image and store its values
in a matrix, where each value is a number between 0-255. Any Clues? Any Code?
Thaaanks.
Greetings Puppies,
I *think* blitz will automatically convert it to 16/32 bit depth. Look at the the ReadPixel and ReadPixelFast commands - search the forums if you need help understanding them because they've been explained to death elsewhere.
Peace,
Jes
Yep, i understand them. I read the image without problems, but i get values like -1671782.
I want values from 0 to 255 :(
Greetings Puppies,
In that case you don't understand them ;0) Try searching the forums, really. You'll find out all about the beauty of masking and bit shifting and I promise you'll get your answers.
Peace,
Jes
I know they are rgb values! I have coded bmp lot of times. Anyway i am searching the forums, hehe. Anyway, knowing that you *think* that Blitz converts it to 16-32 bits depth is a help.
Thanks.
Found IT!
argb=ReadPixelFast(x,y,ImageBuffer(image_name))
gotr=(ARGB Shr 16) And $ff
gotg=(ARGB Shr 8) And $ff
gotb=ARGB And $ff
GrayValue = (gotg+gotr+gotb) / 3
Greetings Puppies,
That's the one! See, the forums can be useful ;0)
Peace,
Jes