When I write "type image.bmp" in the cmd, what are those symbols it returns?
They're the char representation of the binary content of the bitmap file.
So, if I save those chars in a txt file, is there any way to turn them back into the image?
Not really, as it could and maybe does omit some of the control characters.
You'd then have to save the image as base64 or as a binary representation.
So, I just save it as image.bin? How do I save it as base 64?
And after I do that, what do I do?
Are you coding in bash or do you have any tools like php or ruby available?
And what do you excatly want to archieve?
Where does the image come from and what do you want to do with it.
If you just want to duplicate it, use cp.
Actualy, I don't really know myself. I'm really just experimenting.

You see, I used this trick I read about and added a bunch of files to a .rar file and then copied it to an image, so you can see only the image. It's kind of steganography.

And I read that this works because the last bit of each pixel is changed and that's how the message is hidden. Now, I got the char representation of the binary content of the image, then I wrote a program to change every char in that file to 1s and 0s. Then I created another file with the last bit of every byte. Then I changed each byte in that new file to a char. Now I want to know how to turn that back in an image.

I have no idea if I'm doing it right (probably not) but like I said I'm really just experimenting. What I want to do is turn a txt file in an image.
Oh, then you should consider moving to a more advanced programming language (C, C#, Java, PHP), as to do this, you need to create a new picture with the same width and height as the old one and then you'd need to read every pixel from the old one and change the least significant bit of every single R, G, B value, to the value of your hidden data. then you can save each pixel to the new image.
To reverse this process, you'd need to read every pixel of the new picture and using AND 1 you can get the least significant bit of every R, G, B value, store each bit in a buffer and get your message back.
As I allways wanted to do this myself, I'd be glad to help you, if you choose C#, Java or PHP as your programming language.

Here's some pseudo PHP code I just wrote for you to understand:

Code:
$srcPic = loadPicture("./srcimage.bmp");
$targetPic = createPicture("./targetimage.bmp",srcPic.width, srcPic.height);
$hiddenData = file_get_contents("./hiddendata.txt"); //only very small ascii data! datasize in bytes must be smaller than imgWidth*imgHeight*3/8
$arrR = array();
$arrG = array();
$arrB = array();
$strPos = 0;
$bytePos = 8;
$for($i=0; $i<($srcPic.width*$srcPic.height)

for($x=0; $x < $srcPic.width; $x++) {
  for($y=0; $y < $srcPic.width; $y++) {
    if($bytePos == 8) {
      $bytePos = 0;
      $byte = (( strlen($hiddenData) < $strPos) ? $hiddenData[$strPos++] : 0 );
      }
      $bit = ($byte >> $bytePos++) & 1;
      $byteR = ($srcPic.getPixelR($x,$y) & 254) | $bit;
      $bit = ($byte >> $bytePos++) & 1;
      $byteG = ($srcPic.getPixelG($x,$y) & 254) | $bit;
      $bit = ($byte >> $bytePos++) & 1;
      $byteB = ($srcPic.getPixelR($x,$y) & 254) | $bit;
}
Still not yet done..
I know how to program in C, and that's all ^_^'' I'm always willing to learn more languages tho. Can you teach me how to do this in C?
I wouldn't be able to write this in C, as I don't know how to maipulate image files there, but I guess PHP would be an option.
PHP has a similar syntax than C and it allows dynamic arrays and stuff that will make our lives easier. And it has imaging support.
Just sudo apt-get install php5

PHP isn't a web only language. You can run it on the command line to do nice stuff.
Alright, I will try Smile
Ok. I can do this with you in PHP if you want to.
If you need help, just ask me.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement