The Daily Click ::. Forums ::. Klik Coding Help ::. BMP-based File Blender
 

Post Reply  Post Oekaki 
 

Posted By Message

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
13th June, 2005 at 16:55:34 -

I'm working on a small little app to conceal a file inside a Bitmap. I may not finish it though, cos i'm very very busy with coursework and other things. So if anyone likes the idea and wants to help out by doing large lumps of it for me, they're welcome (ask permission first tho, lol).

The application will only work with files that meet the following criteria:

BMP Requirements
---File Type: BM (basically, a standard
Bitmap file. Not an
Icon, or a Cursor.
The first two bytes
must read 'BM'. )
---Colour Depth: 24 bits (possibly also 32 bits)
---Compression: None.
---Image Size: Must be large enough to hide
the original file. We'll get
to this later.


The app will also feature 8 quality settings. The higher the quality, the bigger the image must be.

Quality Settings
Quality Result
1 Lossless (Alterations to the image will
be invisible to the naked eye)
2 Lossless (Alterations should still be
almost invisible)
3 Quality (Some small variation in shade)
4 Medium (More variation)
5 Low (Variation will probably be
high)
6 Very low (Original image may be hard to
discern)
7 Almost Lost (Original image will be almost
idistinguishable)
8 Lost (Original image will be gone)


The effect of the blend basically causes a kind of noise to appear in the image. The lower the quality, the more 'noisy' the image may appear.

How it works

It works by taking every byte of each pixel (there are three bytes per pixel, one for Red, Green and Blue) and removing some bits at the end. The number of bits it removes is based on the the quality setting (so 1 removes 1 bit per byte; 2 removes 2 bits per byte; and so on).

It then replaces the lost bit(s) with bits from the original file. Eg:

Original Pixel Colour:
R 00000000 = 000
G 00000000 = 000
B 11111111 = 255

Byte to Blend:
11 01 01 10 = 214 (at quality #2, this will take 4 bytes)

Colour with bits stripped off (where quality = 2)
R 00000000 = 000
G 00000000 = 000
B 11111100 = 252

Result once blended
R 00000011 = 003
G 00000001 = 001
B 11111101 = 253

This leaves a remainder of two bits, which would
be blended with the next byte in the file. But
hopefully you can see how it affects the image
quality. If you open paint and make two coloured
boxes, one of 0,0,255 and one of 3,1,253, I hope
you'll see that there's barely any difference.


As I mentioned earlier, there are certain size restraints. The BMP file must have enough pixels (height X width) in it to hold all the bytes of the other file.

The application itself will tell you how many pixels you need, but to give a basic example, here are a list of image sizes necessary to hold a 10,000 byte file.

Quality Minimum pixels needed
1 26,667
2 13,334
3 8,889
4 6,667
5 5,334
6 4,445
7 3,810
8 3,334


26,667 sounds a lot, but it's only a 164x163 picture.

This would be designed to work mainly at high qualities with small-ish files (such as ini files, game saves, array files, etc. Not huge many-megabyte files).

Anyway, my time's run out, so I'll leave you to comment as you wish. I hope at least someone's interested in this. I always thought it was quite cool to be able to blend a file with a bitmap and not be able to see any difference to the eye or the filesize...

 
191 / 9999 * 7 + 191 * 7

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
13th June, 2005 at 17:16:41 -

Dines this idea rules. Hiding files in bmp images is a really cool idea, and for sneaky artists like me it would be a really neat way of getting information around. I have no idea how to make a program like this but if I did I would gladly help. I hope you do finish this at some point, I'd be willing to pay for a decent app that did that.

 
Current project:
Dynabrick (%70)

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
13th June, 2005 at 18:52:05 -

Well it seems the perfect place to hide something!

People could be wondering for weeks where the game saves are stored, only to find that they're embedded in the title screen. A 640x480 game has 307,200 pixels on screen. You could store a 230k zip file full of gamesaves in that (at just 2x quality!).

The only three things you need to pull this off are:
1. Binary Object
2. Base Converter Object
3. A file explaining BMP format

Image Edited by the Author.

 
191 / 9999 * 7 + 191 * 7

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
14th June, 2005 at 11:40:30 -

Smart idea!

 
.

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
13th September, 2005 at 16:14:05 -

Sorry to resurrect a long-dead post, but just an update for any interested. I think I've just generated the first working blend. I'm about to check that it can actually be reversed, lol, because I haven't built the reverser, but it seems promising.

The file can still be read as a bmp anyway, which is a turn up for the books. I expected to have tons of trouble making it re-loadable in paint, but Binary Object's stuck to the spec quite well. Which is unusual.

I'll see if I can post some before and afters to show the compression ratios.

 
191 / 9999 * 7 + 191 * 7

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
13th September, 2005 at 19:52:28 -

Sounds promising, be sure to keep us updated.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
14th September, 2005 at 18:44:13 -

And here's an example of the compression ratios.
Image
There are nine in total.

None
This is what the bmp file looks like without anything blended

1-bit compression
Using 1-bit compression, 384 bytes of ascii text are blended with this picture. Regardless of how much you zoom in, you won't notice the noise created.

2-bit compression
768 bytes of text. Again, to the naked eye (even at high levels of zoom), there is no visible loss in quality.

3-bit compression
1,152 bytes. At a standard screen resolution there is still no change, but zooming in will start to show slight dithering.

4-bit compression
1,536 bytes. Dithering is starting to notice even at a normal resolution (1024x76. With zoom, the noise is getting kinda ugly.

5-bit compression
1,920 bytes. Ugly. The picture says it all. We're actually losing brightness now. The whole image is less luminant than the ones before it, and we're losing contrast.

6-bit compression
2,304 bytes. Worse. Contrast and luminance have suffered more. Patches of similar colours are becoming hard to distinguish from each other.

7-bit compression
2,688 bytes. Hideous. Colours are bleeding into each other. The blues of the background are totally mixed.

8-bit compression
3,072 bytes. Maximum file blend with minimum quality. The original image is lost. What you see here is made entirely from the binary data of the original file. Apart from the header info in the BMP, the original image is gone forever.

Practicalities
Anything between 1 and 3 are the best blending ratios to use. A 640x480 picture at 3-bit quality would hold a 345k zip file.

PNG files are another lossless format. These can be combined with this system, so that a bmp file doesn't need to be as big as it normally would be.

 
191 / 9999 * 7 + 191 * 7

tdc052621



Registered
  20/12/2002
Points
  908
14th September, 2005 at 19:32:40 -

mwa hahahaha, a new way to encrypt files.

 
n/a

Keatontech!

Possibly Insane

Registered
  10/07/2005
Points
  2720
14th September, 2005 at 19:37:57 -

You mean there is text hidden in those images! WOW that is awesome!

 
Happily Using Mac Now

I Officially Leave-d !

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
15th September, 2005 at 01:37:21 -

I seem to remember an old application called Stegano that did this.

 
n/a

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
15th September, 2005 at 04:30:20 -

Radix: Yeah, although I think Stegano uses a different system since it can embed files in JPEG. That wouldn't be possible with my method because JPEG is lossy. I can't imagine how they watermark a jpeg, lol. I read their patents and it sounds complicated

Keaton: At the moment those contain text, but you can shove anything in them. So long as the file size is small enough, those could be zip files. I used text for the examples because it's easier to change the length.

 
191 / 9999 * 7 + 191 * 7

Keatontech!

Possibly Insane

Registered
  10/07/2005
Points
  2720
15th September, 2005 at 16:39:52 -

Wow, so you could hide a picture in a picture, thats really cool!

 
Happily Using Mac Now

I Officially Leave-d !

tdc052621



Registered
  20/12/2002
Points
  908
15th September, 2005 at 19:44:00 -

hey, thats a good idea for preventing kids from looking at p0rn.
Adults who want to view porn must have a converter to look at it, Kids who access a p0rn site will only see a picture of a bunny while the real picture is hidden in it.

 
n/a

JP



Registered
  07/06/2003
Points
  1338
15th September, 2005 at 20:59:31 -

i'm going to hide hardcore porn in my myspace pic

 
Steve Zissou: Anne-Marie, do all the interns get Glocks?

Anne-Marie: No, they have to share one.

Deleted User
15th September, 2005 at 22:07:45 -

sounds like a new way to spread viruses...

 
   

Post Reply



 



Advertisement

Worth A Click