i want to know how to find the size of original image & compressed image..

5 views (last 30 days)

file size is 77381 width is 728 height is 485 bitdepth is 23

according to me size of original image is width*height*bitdepth/8 = 728*485*24/8 = 1059240 why we divide it by 8 and size of compressed image is 77381 am i right let me guys

Answers (2)

Walter Roberson
Walter Roberson on 6 Dec 2013
bitdepth 24 is 24 bits not 24 bytes. There are 8 bits per byte, so 24 bits is 24/8 = 3 bytes. The bits per byte is why you divide by 8.
However, the FileSize you see in the listing includes the JPEG headers, not the amount of data needed to be stored to represent just the image. The JPEG headers may include information such as date and time. But they also contain subtle information about which algorithm was used to encode the data, and that information needs to be counted along with the compressed data itself.
  2 Comments
azizullah khan
azizullah khan on 7 Dec 2013
Dear sir .am not clear about compressed image and original image size. if we apply apply fft or dct or pca,then after apply these compression tools how to find the size of the compressed image.
Walter Roberson
Walter Roberson on 7 Dec 2013
fft is not a compression method. The closest you could get to compression with fft itself would be the equivalent of low-pass filtering before doing another stage.
pca is not compression in itself, but it can be used as a step in deciding which information makes the most difference in compression.
dct of a block produces an output matrix in which some of the elements will tend towards 0. If you leave out small elements and substitute 0 for them when you reconstruct the image, then for that block the loss will not look like much. For each block, you need to store the components you did not throw away, along with how many you kept. If you add up all of the memory needed to store the saved components for each block, together with the memory needed to store the number of components that you kept for each block, then the total will be the amount of memory needed to store the compressed image in memory. But that is not exactly the same thing as the amount of memory needed to store an image in a JPEG file, because the JPEG format adds some extra overhead bytes. The FileSize information that you see in that GUI is the file size including all of the overhead.
The original image size is the bytes needed to hold the original image _in memory in fully-expanded form, (width times height times bitdepth divided by 8 bits/byte)

Sign in to comment.


David Sanchez
David Sanchez on 6 Nov 2013
Use size for it.
[rows cols layers] = size(your_image); % where your_image is the name you gave to your image when reading it
[rows2 cols2 layers2] = size(your_compressed_image);
  2 Comments
chitresh
chitresh on 6 Nov 2013
thats gives rows, columns and layers value, not the original size of the image & compressed image size... i know its formula too & i have mention in the question body part but not sure, and according to you dear its always same size for original image and compressed image so its not correct
azizullah khan
azizullah khan on 6 Dec 2013
by using [rows cols layers]=size(your_image) will give you the same size both for original and compressed .Kindly if anyone have idea about it please share it.Thanks in advance.Please help me.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!