Page 1 of 1

Picture to .txt and vice versa

Posted: Sun Oct 30, 2011 1:07 am
by -AMC-
Hi to all...
Someone, somewhere (maybe even here, I really don't remember, I've tried to find the post, to see if he had finished the program, but without success) had the idea to make a program that will convert a picture into a .txt file (NOT to make picture inside txt as with ASCGEN2 and similar programs, but to "translate" each pixel of picture to a text code).
I would like to make something similar, almost the same. For example, a pixel with color code #FF0000 to be converted to text [#FF0000], or some random combination of letters, unique for every color (e.g. #FF0000 pixel to text [LE#h:IF.]), and so for every pixel of the picture.
Then I want to save it as .txt , and when I open that .txt file with notepad to see simply the "code" of the picture, but when I run it with my program, to convert it back to normal picture, as it was before (without change of width, height,etc).
It would be a simple program with 1 textbox, 1 picturebox, and buttons to open, convert, and save files. That's how I imagine the program, but I don't know how to code it.
I hope that I explained correctly what I want to do.
Of course, all credits would go to the person who makes the code, and to the person whose idea this originally was.


PS. USMAN55 TRIED TO FIND HIS OLD PROGRAM, BUT WITHOUT SUCCESS, SO THE REQUEST IS STILL ON.

Re: Picture to .txt and vice versa

Posted: Sun Oct 30, 2011 1:33 am
by comathi
Oh yeah, I had seen a contest for something like that on here. I think it turned out it would take too many operations (like several million), which would be too much for your computer.

Re: Picture to .txt and vice versa

Posted: Sun Oct 30, 2011 3:47 am
by Cheatmasterbw
You can probably have a text file layout like this:
Code: Select all
#FF0000#00FF00#0000FF
#FFFF00#FF00FF#00FFFF
#FFFFFF#808080#000000
The program would know the text file is 3x3 because there are 3 lines, and 3 "#" on each line

Re: Picture to .txt and vice versa

Posted: Sun Oct 30, 2011 1:57 pm
by Usman55
I think it was my program that you saw. I'll try to find it. And comathi, it's nothing like that. The coding was real simple and translated a picture into a single txt file.

Re: Picture to .txt and vice versa

Posted: Sun Oct 30, 2011 2:44 pm
by -AMC-
Could be...Tnx! :)