I want to create a .png image that actually has data in it - and is a real image.

It will probably be about 2.5 MB, but I want to trick Ubuntu into saying it is a different size - say 1.5 MB.

Is this possible? Can the size of an image be written by a computer program, like imagemagik?

  • This cannot be done. You may be able to change the way nautilus finds file sizes and recompile it but any program could find the real size easily. – Grammargeek Jun 25 '15 at 17:02
  • I think no you can't. – vembutech Jun 25 '15 at 17:08

NTFS has some feature called ADS (Alternate Data Stream) which allows you to add data to a file which has no impact on the displayed file size. Maybe something like this also exists for Linux file system like ext4?


Assuming you are not talking about steganography, you can hide a big image in a bigger file (perhaps the opposite of your question), simply by concatenating it on the end of another smaller image.

Though you wont fool ls you will fool many programs that display or manipulate the image, as they will only see the first part of the file and report the size of the first image and ignore the second bigger image.

cat a.png b.png >new.png
identify a.png b.png new.png

a.png   PNG 114x98 114x98+0+0 8-bit sRGB 2.51KB 0.000u 0:00.000
b.png   PNG 81x54  81x54+0+0 8-bit sRGB 256c 2.86KB 0.000u 0:00.000
new.png PNG 114x98 114x98+0+0 8-bit sRGB 5.36KB 0.000u 0:00.000

No. The size of a file is the number of bytes it occupies. You cannot do something to your image file to somehow force the OS to report a different number of bytes than the data within the file occupies.

  • Even with meta data or similar? – Tim Jun 25 '15 at 17:10
  • Any data embedded in the file accounts towards the size of the file, as it is part of the file. – dobey Jun 25 '15 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.