Compressing Text by Images This is an algorithm that can be used to Compress files.This can be used to compress the files by converting files into images. Note:This is my own technique and I did n’t copy it from internet Zip format and Rar format: You must have heard about Zip and RAR formats which are used to compress files so that they occupy smaller space.Those Zip and RAR formats use Central Directory and insert a backdoor entry for those My format: Compression: This algorithm can be used to compress characters by converting them into pixels of a image.E.g 3 characters in the file are converted into RGB values of a pixel and pixels are combined to get a image RGB- Red,Green,Blue values of a pixel.Each pixel is defined by it’s RGB values .In real time there are 256X256X256 colors (compressed format) Decompression: The pixels of the image(compressed) are read by the script and the RGB values are converted into characters. Steps involved in it : First Step: Get the Contents of the File. Second Step: Split the characters in the file into chunk of 3. Third Step: Get the count of chunks Fourth Step: Convert of each of the character into Decimal using ASCII table Fifth Step: Then set the pixel it a particular point using (R,G,B) Sixth Step: Then increment it to next level Seventh Step: Then repeat steps 4-7 for another chunk. Eight Step: Join the pixels to get the image . E.g Let us take the word Sachin Step 1: “Sachin†Step 2: 1—>â€Sac†2—>â€hin†Step 3: Count of chunks:2 (Since “Sacâ€,â€hinâ€) Step 4: For Sac: Converting each character into ASCII value So “Sacâ€==>â€83,97,99″ “hinâ€==>â€104,105,110″ step 5: RGB values of pixel at x=1 and y=1 would be (83,97,99) ===>(Sac) RGB values of pixel at x=2 and y=1 would be (104,105,110)===>(hin) Step 6: these pixels would be combined to form a image.. Decompression: Step 7: pixels of the image would be read by the script and converted into RGB values In this case pixel 1: (83,97,99) pixel 2: (104,105,110) Step 8: RGB Values would converted to ASCII characters 83---->S 97---->A 99---->C 104--->H 105--->I 110--->N We will get the original Text.."SACHIN" Compression: This algorithm is used to compress characters by converting them into pixels of a image.E.g 3 characters in file are converted into RGB values of a pixel and pixels are combined to get a image Decompression: Pixels are converted into characters and they are joined at the end to get the original file. Results: Original File Size:3.00 MB Zip:2.35 MB My format~2.40 MB Difference is just 2~4% between my format and Zip. I think this can be further reduced by using mathematical techniques in reducing the RGB values which is possible.. I was able to reduce a 721 KB Media file into 649 KB file by manipulation techniques..(Zip format and Rar format were able to reduce only to 700KB) I think someone better than me who have more time would be able to bring in some new methods using this algorithm. Files are attached with this thread.. a)There would be two variables sourcefilename and targetfilenamesourcefilename=>name of the file that would be compressed (the file has to be in the same folder as compress.php) targetfilename->name of the compressed file (after compressing) b)At the top of the file decompress.php ,there would be two variables sourcefilename and targetfilename sourcefilename=>name of the file that would be decompressed (the file has to be in the same folder as decompress.php) targetfilename->name of the decompressed file (after decompressing) Mods:If this is not the right place move this thread to the correct one..
The easiest way is to just use 7zip. Impressive btw, I wouldn't think to split unless I looked at how Linux managed archives.
Can you tell me what error you are getting?? I am posting it here .. only to have some good review comments about it..
Interesting. What you are really doing is relying on the PNG file compression that can be described as a generic lossless compression. This kind of compression is used by both zip and rar algorithms. Anyway I've done some tests and here are the results: 1) TXT file, size: 63KB -----> your compression shrinks it down to 21KB; -----> RAR : 13KB. 2) JPG file, size: 49K ------> your result: 46KB; ------> RAR: 43KB. Conclusion: It is a good, pretty fast technique to compress something whenever you don't have any other tools handy.
Good one.. It's better to find a technique to split characters into three and using combinations to convert it into an image. This can be used for compression and also to prevent data theft... Good idea....
When I try to use it with smaller files, it works fine. I tried using it to compress a song that was ~3 or 4 MB. it gave me this error: Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: image size exceeds user limits in IHDR in Code (markup): It's uploaded here http://gamingjunkiez.com/test/compress.php Code (markup):
WeedGrinch: I don't think you understand this is for 'text' files not binary files. OP: I would like to see one of these images that your compression has produced. Would be nice to see what each of the major documents in history looks like under your compression as a image. Never know something might turn out to be a 'pretty' image or could look like a jumbled mess of stuff.
I think it may be related with memory used by the scripts Image is of No of pixels x1 size. .(Image would be only a straight line but it can be converted to any dimensions day 1024x1024 depending upon the size)
This technique is not new, I guess...its just called stenography in common terms..isn't it? Correct me if um wrong...
Srry, I meant StegAnography, not stenography...Steganography refers to the practice of hiding info within pics etc such that its encrypted...what u did is quite similar to info hiding..
That's all about hiding messages in a pictures of your choice http://mozaiq.org/encrypt/ But here it's deals with compression of data and here picture created is not of your choice.It's is automatically created so it's entirely different from Steganography.