Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

why has my received image's size increased after transfer?

Asked by Sweta on 27 Jul 2013

For my project, i am testing MMS behavior of different file format of different dimension. before sending the MMS, it converts my msg to MMS, converting PNG images to JPG file. Here only the file size reduces drastically because the dimension has reduced. Till now its good.

Now when I send the now JPG image via MMS, if my file sent was 31.2KB, when received it becomes 31.3KB and in some situation the increase is bigger. This happen only with PNG file which upon transmission change the PNG to JPG before sending and thus I receive a bigger (in KB) JPG image. All other format (BMP, JPG, GIF) remain same or decrease in size (KB). I did the same test series more than 10 times and the change is consistent, same change always. It happen with big dimension image only (>500KB) as smaller ones remain PNG format when send and received.

BMP Original Image: bmp_810KB.bmp - 576x480 - 810KB --Sent Image: bmp_810KB.jpg - 288x240 - 8.94KB --Received Image: bmp_810KB.jpg - 288x240 - 8.78KB

JPG Original Image: jpg_810KB.jpg - 1024x957 - 810KB --Sent Image: jpg_810KB.jpg - 514x480 - 34.9KB --Received Image: jpg_810KB.jpg - 514x480 - 28KB

PNG Original Image: png_810KB.png - 700x525 - 810KB --Sent Image: png_810KB.jpg - 640x480 - 55KB --Received Image: png_810KB.jpg - 640x480 - 55.9KB

I have tried to check RGB percentage change, HSV changes, MSE but I cannot get a proper pattern that can explain this increase in size. Is it redundant data? I have no idea how to calculate that on matlab?

If someone has an idea about what can be changing to cause the increase please do help me out.

Thanks, S

0 Comments

Sweta

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 27 Jul 2013

What kind of system are you sending from, and what kind of system are you sending to?

Is it possible that the sending system measures size in "kilobytes" (1024 bytes per kilobyte) and that the receiving system measures size in "kibibytes" (1000 bytes per kilobyte) ?

7 Comments

Sweta on 29 Jul 2013

I tried imfinfo() but the information is very limited and looks same for sent and received image.

>> info = imfinfo('png_2000KB_s.jpg')

info =

           Filename: 'C:\Program Files\MATLAB\R2012a\Mine_Test\png_2000KB_s.jpg'
        FileModDate: '03-Jul-2013 19:12:24'
           FileSize: 65134
             Format: 'jpg'
      FormatVersion: ''
              Width: 640
             Height: 480
           BitDepth: 24
          ColorType: 'truecolor'
    FormatSignature: ''
    NumberOfSamples: 3
       CodingMethod: 'Huffman'
      CodingProcess: 'Sequential'
            Comment: {}

>> info = imfinfo('png_2000KB_r.jpg')

info =

           Filename: 'C:\Program Files\MATLAB\R2012a\Mine_Test\png_2000KB_r.jpg'
        FileModDate: '02-Jul-2013 19:17:28'
           FileSize: 66043
             Format: 'jpg'
      FormatVersion: ''
              Width: 640
             Height: 480
           BitDepth: 24
          ColorType: 'truecolor'
    FormatSignature: ''
    NumberOfSamples: 3
       CodingMethod: 'Huffman'
      CodingProcess: 'Sequential'
            Comment: {}

I am using MATLAB2012 and to get info about EXIF I have to install ExifTool. I will try your suggestion and check the Exif info to see if there are some differences in there.

Thanks for your suggestion. Will keep you posted :) Thanks

Walter Roberson on 29 Jul 2013

Huffman / Sequential is JPEG's lossless compression algorithm. It is not as efficient as the DEFLATE algorithm used for PNG files, because of the preprocessing that PNG uses to reduce the complexity of the bitstream, and the improvements that dynamic huffman (DEFLATE) can have over static huffman (JPEG)

Sweta on 29 Jul 2013

I tried to extract the EXIF info and I find only one similarity in all my files which have increased in size.. the JFIFVersion! For my sent files it is JFIFVersion 1.01, but my received files are JFIFVersion 1.02.

FileName : png_1799KB_s.jpg ------------------------------ FileName : png_1799KB_r.jpg

FileSize : 41 kB ---------------------------------------------------- FileSize : 42 kB

FileType : JPEG --------------------------------------------------- FileType : JPEG

MIMEType : image/jpeg ----------------------------------------- MIMEType : image/jpeg

JFIFVersion : 1.01 ------------------------------------------------ JFIFVersion : 1.02

EncodingProcess : Baseline DCT, Huffman coding ---- EncodingProcess : Baseline DCT, Huffman coding

YCbCrSubSampling : YCbCr4:2:0 (2 2) --------------------- YCbCrSubSampling : YCbCr4:2:0 (2 2)

ImageSize : 582x480 ---------------------------------------------- ImageSize : 582x480

Can this change in format (and all other info remaining same) be a reason for a slight change in size? Some which were 1.01, changed to 1.02 but has a change in YCbCrSubSampling from YCbCr4:2:0 to YCbCr4:2:0 (2 2). Those were the JPEG files which decrease in size.

Only PNG from origin converted to 1.01 first and changed to 1.02 upon received but all other info are same. Apparently JFIF 1.02 stores more info? However, I did not find yet a reliable source online that states that JFIF 1.02 did influence file size. According to you, can this explain the slight increase in size? If yes, how to prove this?

Thank you very much for your help.

Walter Roberson

Contact us