How to create empty (0x0) image?

10.1k views Asked by At

I'm trying to figure out a way to create a zero-width, zero-height image which would conform to the standard of whichever format works.

I've already tried the Windows Bitmap (BMP) format (54-byte header only file), but it appears that image readers will not accept it.

Theoretical 0x0-BMP byte string:

424D360000000000000036000000280000000000000000000000010020000000000000000000C40E0000C40E00000000000000000000

Which format would support this, and which tools can I use to create it? Even a programming solution would suffice (e.g. a C# System.Drawing script).

3

There are 3 answers

0
Jon Hanna On BEST ANSWER

Image readers will tend not to accept a width of less than 1 or a height of less than 1. Hence we need to stay with 1x1 as the minimum that can be practically used, even if 0x0 is allowed by the specs of some image formats. A 67-byte PNG is detailed at http://garethrees.org/2007/11/14/pngcrush/ perhaps the smallest possible. A transparent one can be done in 67 bytes also.

1
AlexSavAlexandrov On

Yeah, a 1x1 transparent image should do the trick. Or you can make a 0x0 object that uses the image. For example: a PictureBox with height = 0 and width = 0, if you are going to use the image in a program. A method that I have used with success.

But from your question, I can't understand if it has any connection with programming, rather than with image making. And I don't understand why do you need a 0x0 image, witch is practically invisible... But I guess you have your reasons.

0
kenorb On

Here is svg file, which is basically empty:

<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg"/>

which is 1x1px by default.

To force 0x0px image, you can try:

<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"/>