Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

lost in translation  RSS feed

 
Justin Fiedler
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does anyone know how to convert an image to a collection of bits (or if not bits then ints, but perferrably bits) that represent the color of each pixel.
for example for an image

bwwwb w - white pixel
wbwbw b - black pixel
wwbww
wbwbw
bwwwb

is there a way to get a bitstring or bitstrings

01110
10101
11011
10101
01110

the images i would be converting would only need to be 2 colors(not necessarily black and white) and do not require aplha values. i would like to avoid large ints or arrays for an individual pixel (such as getting RBG and alpha bits). the reason is i would like to be able to do bit operations on these strings such as 'or', 'and', 'xor', etc. for quick comparisons. any help will be greatly appreciated. thank you.
-justin
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm curious if you'll get an answer to this question. I tried to figure that out for a while, and ended up with some strange looking pictures. Inverted colors, scaling issues... Good luck...

Although, with recently gained knowledge, I migh have been able to deal with those issues...
 
Justin Fiedler
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would not need/want to convert these images back to there orginal form. mainly i just want to know whether each pixel is one color or another(perferably black and white) and record a bit accordingly. do you know how i could do this (and fast)? honestly ANY information or hints will help me greatly.
-justin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!