Jump to content

Is there any program that can turn some binary code into a black and white image?

Is there any program/app that can get some binary code, and turn it in a black and white image. By that i mean get this image where the 0 are represented by the color black and the 1 with the color white.The example shown well Its a short creepy pasta story from a game. But that doesnt matter, what matters is can i do the same? Or am i gonna have to do it manually?

image.thumb.png.e97716a5572d6b4ea055740ed2a2a86f.png

Link to comment
Share on other sites

Link to post
Share on other sites

It should be easy enough to make. 

 

What language do you use?

Want to know which mobo to get?

Spoiler

Choose whatever you need. Any more, you're wasting your money. Any less, and you don't get the features you need.

 

Only you know what you need to do with your computer, so nobody's really qualified to answer this question except for you.

 

chEcK iNsidE sPoilEr fOr a tREat!

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, NoRomanBatmansAllowed said:

It should be easy enough to make. 

 

What language do you use?

hah well im gonna be using text to base 64 and then binary which will make that so loooong

Link to comment
Share on other sites

Link to post
Share on other sites

Why do you even need base64? Base64 is so that you can represent binary data as a string (most often), but if you're writing to a bitmap the string representation is an unnecessary step and is rather silly. Look at the 24-bit BMP file format, this is very easy to do as the actual image data is basically just the (A)RGB colors of each pixel. The header specifies things like the size and image dimensions. I did this a long time ago to encode data into images. The only catch here is that if you want pure grayscale, you'll have to encode the data as such and thus you won't be able to have each byte of data in its own color component AFAIK. Can't remember if there's some kind of grayscale option for bitmaps, but I doubt it.

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, bitm0de said:

Why do you even need base64? Base64 is so that you can represent binary data as a string (most often), but if you're writing to a bitmap the string representation is an unnecessary step and is rather silly. Look at the 24-bit BMP file format, this is very easy to do as the actual image data is basically just the (A)RGB colors of each pixel. The header specifies things like the size and image dimensions. I did this a long time ago to encode data into images.

why? because its the only thing i can think of to convert from text. And im doing this for a challenge me and my friend put up, something that you dont want the other friend to know about. So yeah

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, YourNewPalAlex said:

why? because its the only thing i can think of to convert from text. And im doing this for a challenge me and my friend put up, something that you dont want the other friend to know about. So yeah

 

" get some binary code, and turn it in a black and white image " - This doesn't align with what you were previously saying. You never mentioned text, and even if you want the binary value of text, base64 is not the answer. You can look at the individual bytes of each character and use them directly to represent the image if that's what you're looking for. Base64 is still highly unnecessary. Encryption would be a better way to go if that's your goal anyways. It's easy to spot Base64 encoded data.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, bitm0de said:

 

" get some binary code, and turn it in a black and white image " - This doesn't align with what you were previously saying. You never mentioned text, and even if you want the binary value of text, base64 is not the answer. You can look at the individual bytes of each character and use them directly to represent the image if that's what you're looking for. Base64 is still highly unnecessary. Encryption would be a better way to go if that's your goal anyways. It's easy to spot Base64 encoded data.

dude i wanted to do text to base 64 to binary then to img. If you think base 64 is easily spottable give me something that isnt.

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, YourNewPalAlex said:

dude i wanted to do text to base 64 to binary then to img. If you think base 64 is easily spottable give me something that isnt.

I already gave you a suggestion. Use an encryption algorithm... Base64 is an encoding, which is easily reversable. If they see a bunch of random bytes however in an image file, even if they know it is encrypted data it won't be as easy to reverse is my point. Text to Base64 to Binary btw if you are worried about the size of the output data, is going to be massive compared to what I'm telling you to do if you read what I'm saying. :/

Link to comment
Share on other sites

Link to post
Share on other sites

22 minutes ago, YourNewPalAlex said:

hah well im gonna be using text to base 64 and then binary which will make that so loooong

wh.... why?

 

Do you know any programming languages?

 

If so it's just reading the text, converting it into its ascii code, shoving that into a string and then just printing it out using a photo.

Want to know which mobo to get?

Spoiler

Choose whatever you need. Any more, you're wasting your money. Any less, and you don't get the features you need.

 

Only you know what you need to do with your computer, so nobody's really qualified to answer this question except for you.

 

chEcK iNsidE sPoilEr fOr a tREat!

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, bitm0de said:

I already gave you a suggestion. Use an encryption algorithm... Base64 is an encoding, which is easily reversable. If they see a bunch of random bytes however in an image file, even if they know it is encrypted it won't be as easy to reverse is my point. Text to Base64 to Binary btw if you are worried about the size of the output data, is going to be massive compared to what I'm telling you if you read what I'm saying.

well i found a site for doing that which saves so much time

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, NoRomanBatmansAllowed said:

wh.... why?

 

Do you know any programming languages?

 

If so it's just reading the text, converting it into its ascii code, shoving that into a string and then just printing it out using a photo.

well no i dont but my fellow college is even worse so i dont expect him to crack it in a dime. Well i suppose it is, and you know what its nice for a biginner like me

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, YourNewPalAlex said:

well no i dont but my fellow college is even worse so i dont expect him to crack it in a dime. Well i suppose it is, and you know what its nice for a biginner like me

I get there are beginners, all of us were at some point.

 

I just don't get how base64 factors into this whatsoever.

Want to know which mobo to get?

Spoiler

Choose whatever you need. Any more, you're wasting your money. Any less, and you don't get the features you need.

 

Only you know what you need to do with your computer, so nobody's really qualified to answer this question except for you.

 

chEcK iNsidE sPoilEr fOr a tREat!

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, bitm0de said:

I already gave you a suggestion. Use an encryption algorithm... Base64 is an encoding, which is easily reversable. If they see a bunch of random bytes however in an image file, even if they know it is encrypted data it won't be as easy to reverse is my point. Text to Base64 to Binary btw if you are worried about the size of the output data, is going to be massive compared to what I'm telling you to do if you read what I'm saying. :/

Okay okay so any encryption algorithms u suggest? Sorry im a beginner, im  a hardware/software guy not a programmer and a coder, but i might start html sometime

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, NoRomanBatmansAllowed said:

I get there are beginners, all of us were at some point.

 

I just don't get how base64 factors into this whatsoever.

well he asked me why i said why and i stated how im gonna "encode " this

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, YourNewPalAlex said:

Okay okay so any encryption algorithms u suggest? Sorry im a beginner, im  a hardware/software guy not a programmer and a coder, but i might start html sometime

If you're a beginner just use xor encryption with some cyclical key. Lots of examples on that. There's attacks that can reverse the data, but unless someone knows how to do this it's still more secure than Base64, and as long as you don't give out the key, it should be a bit more secure.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, YourNewPalAlex said:

Okay okay so any encryption algorithms u suggest? Sorry im a beginner, im  a hardware/software guy not a programmer and a coder, but i might start html sometime

 

1 minute ago, YourNewPalAlex said:

well he asked me why i said why and i stated how im gonna "encode " this

Why do you need encryption? I thought you just wanted the binaries in black and white on a photo.

Want to know which mobo to get?

Spoiler

Choose whatever you need. Any more, you're wasting your money. Any less, and you don't get the features you need.

 

Only you know what you need to do with your computer, so nobody's really qualified to answer this question except for you.

 

chEcK iNsidE sPoilEr fOr a tREat!

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, NoRomanBatmansAllowed said:

 

Why do you need encryption? I thought you just wanted the binaries in black and white on a photo.

I thought he was using Base64 as an attempt to hide the initial data as input.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, NoRomanBatmansAllowed said:

 

Why do you need encryption? I thought you just wanted the binaries in black and white on a photo.

Dude please read the forum fully. I dont wanna explain again

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, bitm0de said:

I thought he was using Base64 as an attempt to hide the initial data as input.

yes

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, YourNewPalAlex said:

Dude please read the forum fully. I dont wanna explain again

image.png.574e64237f66f7878b361f6d16cc0b3a.png

I don't see any mention of encryption here.

Want to know which mobo to get?

Spoiler

Choose whatever you need. Any more, you're wasting your money. Any less, and you don't get the features you need.

 

Only you know what you need to do with your computer, so nobody's really qualified to answer this question except for you.

 

chEcK iNsidE sPoilEr fOr a tREat!

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, YourNewPalAlex said:

yes

Example:

 

10 = original value

10 ^ 20 = 30 (encrypted)
30 ^ 20 = 10 (decrypted)

 

20 being the key in this case, but you can cycle through a bunch of values cyclically to have a little more randomization. Probably suitable for what you're trying to do for a beginner project.

Link to comment
Share on other sites

Link to post
Share on other sites

You can use a very simple and basic image file format, like PBM for example (portable graymap) : https://en.wikipedia.org/wiki/Netpbm_format

 

For example, this is a  2 x 3 pixel black and white image , save it as file.pbm

 

P1
# This is a comment. ignored by image viewers. Next line contains width and height separated by a space
2 3
1 0 1
1 1 1
0 1 1

 

So let's say you have some text that you want to convert to image... each character is a byte, which has 8 bits... so your image will have to be a multiple of 8 bits in width, and height can be as much as you want.

For example, if you have a text that's 100 characters, then you could have 5 characters wide ( 40 pixels) and  100 / 5 characters per line = 20 lines , so you have a 40 x 20 pixel black and white image.

 

The individual bits from a byte can be easily determined in any programming language.

 

Anyway, at the end you can load the image in a viewer like Irfanview and save it in a more common format, like PNG or GIF.

 

Link to comment
Share on other sites

Link to post
Share on other sites

50 minutes ago, mariushm said:

You can use a very simple and basic image file format, like PBM for example (portable graymap) : https://en.wikipedia.org/wiki/Netpbm_format

 

For example, this is a  2 x 3 pixel black and white image , save it as file.pbm

 

Anyway, at the end you can load the image in a viewer like Irfanview and save it in a more common format, like PNG or GIF.

 

 

later edit:

 

i got bored and wrote something in php using built in functions ... here's link to play with :  http://savedonthe.net/a/createpng.php

 

It creates a PNG file using at most 2048 bytes from whatever file you give it.

 

The source code is here, it's ugly because i repurposed an upload form from another project and just deleted the stuff that wasn't needed

 

<html>
<head>
<title></title>
<body>
<form enctype="multipart/form-data" name="upload-text" method="post" action="createpng.php">
<table cellpadding="5">
	<tr><td valign="top" colspan="2"><p>Click on the Browse button below and select the file you wish to upload to us:</p></td></tr>
	<tr><td valign="top" colspan="2"><input type="file" name="file" size="76" style="width:100%;" /></td></tr>
	<tr><td valign="top"></td><td valign="top" align="right">
		<input name="submitted" type="hidden" value="1" />
		<input style="width:76px;" name="submit" type="submit" value=" Upload " /></td>
	</tr>
</table>
</form>

<?php

$error=0; 
$errorstring ='';
$content = '';
//var_dump($_REQUEST);
$submitted = isset($_REQUEST['submitted']) ? $_REQUEST['submitted'] : 0;
if ($submitted!=1) {
	$submitted=0;
}
if ($submitted==1) {
if (($submitted==1) && ($error==0)) {
	if (!isset($_FILES['file'])) {
		$error=1;$errorstring.='<li>File was not uploaded on the web server</li>';
	} else {
		$file = $_FILES['file'];
		if ($file['error']!= UPLOAD_ERR_OK) {
			$error=1;$errorstring.='<li>File was not uploaded on the web server, probably because it exceeds the imposed file size limit</li>';
		} 
	}
}

if (($submitted==1) && ($error==0)) {
  $h = fopen($file['tmp_name'],'rb');
  $content = fread($h,2048);
  fclose($h);
  $size = strlen($content);

  echo '<p>Read '.$size.' bytes from file.</p>';
  if ($size<2048) {
    echo '<p>Read less than 2048 bytes, padding with null bytes to 2048 bytes to create 128x128 pixel image.</p>';  
    $content = str_pad($content,2048,chr(0x00));
  }

$image = imagecreatetruecolor(128,128);
$c_white = imagecolorallocate($image,255,255,255);
$c_black = imagecolorallocate($image,0,0,0);
for ($j=0;$j<128;$j++) {
 for ($i=0;$i<16;$i++) {
   $character = substr($content,($j*16) + $i,1);
   $charbits = str_pad(decbin(ord($character)),8,'0',STR_PAD_LEFT);

   for ($k=0;$k<8;$k++) {
     if (substr($charbits,$k,1)=='1') {
       $ret = imagesetpixel($image,$i*8+$k,$j,$c_white);
     } else {
       $ret = imagesetpixel($image,$i*8+$k,$j,$c_black); 	
     }
   }
   
 }
}

imagepng($image,'output.png');
imagedestroy($image);
echo '<img src="output.png" />';
}
if (($submitted==1) && ($error==1)) {
 echo '<p>Errors:<ul>'.$errorstring.'</ul></p>';
}

}

?>
</body>
</html>

 

Link to comment
Share on other sites

Link to post
Share on other sites

My idea was to write the raw file format itself directly instead of using built in functions or libraries. It's quite easy even with standard bitmaps to do this, and I wrote code to do it in C a few years ago but in color.

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, you could write a BMP picture easily with raw C (or whatever) code, and the bitmap file format is super simple. There's just some basic quirks, like the data being from bottom to top, line by line, and each horizontal line must be a multiple of 4 bytes , so for example a line that's 10 pixels wide and RGB would have 30 bytes, so you'd pad it with 2 bytes so that it would be 32 bytes in total.

 

See http://www.dragonwins.com/domains/getteched/bmp/bmpfileformat.htm

or http://www.di.unito.it/~marcog/SM/BMPformat-Wiki.pdf

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×