Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

reading bmps


ghost's Avatar
0 0

i want to make a program in c, to convert a bmp (or other types) file to text. i have read some thing about the structures of the headers, but i dont know how to start. any help?


ghost's Avatar
0 0

you mean that you can see the shapes of the pictures in ASCII? else just let C change the name to .txt ;)


ghost's Avatar
0 0

i mean to read the bits of each pixel, so i can change them. something like steganography.


ghost's Avatar
0 0

you could read the file you'd gt text the encrypt that some how then you could save it and have a decrypter. to fix itmarkup #!/usr/bin/python a=open('image.bmp', 'r')#open file to encode b=a.read().replace('a','password')#chnage a to password #Or some encryoting algo. c=open('image1.enc', 'w')#make a file .enc (ranodm lol) c.write(b)# write to it c.close()#close files a.close() that will take a bmp file and make it impossible to view by replacing all the a's in the encoding with password. this is the decoder.

#!/usr/bin/python
a=open('image1.enc', 'r')#opne image file
b=a.read().replace('password','a')# read it and chnage pasword to a
#or the revearse algo
c=open('image.bmp', 'w')#open file to wreite to
c.write(b)#wriet to it
c.close()#close files
a.close()

That would do it, its a bit conveluted but it makes it easier to understand