0

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?

1
  • 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. Jun 25, 2015 at 17:02

2 Answers 2

2

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
0

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.

2
  • Even with meta data or similar?
    – Tim
    Jun 25, 2015 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, 2015 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .