Announcement

Collapse
No announcement yet.

JPG lossless transformations reduces file size too much

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    JPG lossless transformations reduces file size too much

    Hello!

    I have been a irfanview user for countless years but this is my 1st post!

    I use JPG lossless transformations on all my photos to permanently rotate them and noticed something recently. The filesizes of the images are dropping a lot - sometimes by 25%. An example that I just tried: original from camera: 2.39MB. After Auto-rotate: 1.74MB. Keep all APP markers is enabled.

    Just want to know if this is "normal". I hope I've not done lossy transformations all these years.

    #2
    Hi,

    make sure you have the option "Optimize JPG file" disabled.
    I don't know what it does but I saw often that this option reduces the file size.

    Regards
    Nils

    Comment


      #3
      Originally posted by derniwi View Post
      Hi,

      make sure you have the option "Optimize JPG file" disabled.
      That option is disabled. I did another trial - 4.83MB to 4.1MB. Now I'm worried if I should use this to rotate photos or not.

      Comment


        #4
        Here's an analysis I did:

        (1) I painted an image of vertical black lines on a white background and saved it as lines.jpg. I then resaved this jpg as lines.bmp for reference.
        (2) next I applied lossless rotation by 90° to the jpg, disabling all optimization and the like ==> size increased from 142 kb to 231 kb!
        (3) I opened the rotated jpg and saved it as bmp
        (4) I reopened this bmp and rotated it back 90°
        (5) I opened a version of Photoshop and imported the reference-bmp from (1) and the bmp from step (4) as two layers of one image and set the overlay-method to "difference"
        (6) the result was a black image, which I saved as lines-difference.bmp
        (7) Opened the lines-difference.bmp in Irfanview and selected Hex-Display

        Result: the vast majority, in excess of 99.9%, of pixels is black (hex00). A few are hex01 or a little more.
        This is presumably due to the fact that the dimensions of the test image are not aligned with the blocksize* of the jpg compression algorithm. The difference certainly does not account for a difference in jpg file size of more than 1% (actually I think much less than that).

        I strongly suspect that the difference in file size results from an asymmetric property of the jpg-compression (perhaps the particular implementation used in Irfanview). Vertical lines result in a smaller file size than horizontal lines.

        Lossless rotation however is doing what it says!

        If anyone knows better, please speak up

        Click image for larger version

Name:	lines.jpg
Views:	1
Size:	141.7 KB
ID:	80727 Click image for larger version

Name:	Kopie von lines.jpg
Views:	1
Size:	230.9 KB
ID:	80729 Click image for larger version

Name:	lines-subtract.png
Views:	1
Size:	14.7 KB
ID:	80728 Click image for larger version

Name:	lines-hex.png
Views:	1
Size:	19.4 KB
ID:	80730

        * "Segmentation into Blocks - The raw image data is chopped into 8x8 pixel blocks (these blocks are the Minimum Coded Unit). This means that the JPEG compression algorithm depends heavily on the position and alignment of these boundaries." from here
        Last edited by jazzman; 17.03.2012, 09:22 PM. Reason: added footnote

        currently running 4.56 / 32 bit

        Comment


          #5
          "JPG lossless transformations reduces file size too much" ?!?
          When optimisation of Huffman table is enabled is normal to have a smaller JPEG file after any loseless action over an unoptimised JPEG.
          Last edited by Jaff; 10.05.2012, 02:00 AM.
          Imi este indiferent ce cred ceilalti despre mine, caci oricum fiecare crede ce-i convine lui si nu ceea ce e real,
          doar ca mi-ar fi placut sa ma vada asa cum sint de fapt, nu asa cum poate le-ar placea lor sa creada. Ei au ales deja...

          ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷··
          ·· · ·M· · ·I· · ·D· · ·I· · ·· ·· ·M· · ·A· · ·N· · ·I· · ·A· · ·C· · ·S· · ··
          ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷··

          Comment


            #6
            Rotating always repacks the JPEG file. The user is offered the choice between standard or optimized Huffman encoding, not whether to do optimization. The result of any operation with the plugin is always a baseline JPEG file, which is usually a little larger than a progressively encoded one.

            Monochrome images are not normally encoded with JPEG compression. They, and anything with blocks of solid color, tend to increase in size if processed by IrfanView.

            It is possible that rubpa's photos are encoded very inefficiently, or that there is additional data appended to each file, specific to the camera or its software. Anything beyond the JPEG stream is stripped during processing.

            Comment


              #7
              @jazzman: You've compared the wrong data! The first bitmap (your refference) is with NO modifications done by compressing the image data as JPEG on step 1!
              Imi este indiferent ce cred ceilalti despre mine, caci oricum fiecare crede ce-i convine lui si nu ceea ce e real,
              doar ca mi-ar fi placut sa ma vada asa cum sint de fapt, nu asa cum poate le-ar placea lor sa creada. Ei au ales deja...

              ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷··
              ·· · ·M· · ·I· · ·D· · ·I· · ·· ·· ·M· · ·A· · ·N· · ·I· · ·A· · ·C· · ·S· · ··
              ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷··

              Comment


                #8
                In my experience black and white images are saved as tif. are smalest in size.

                Comment


                  #9
                  Depends on compression used... Anyway, try PNG format instead of tiff Now who's smaller?
                  Imi este indiferent ce cred ceilalti despre mine, caci oricum fiecare crede ce-i convine lui si nu ceea ce e real,
                  doar ca mi-ar fi placut sa ma vada asa cum sint de fapt, nu asa cum poate le-ar placea lor sa creada. Ei au ales deja...

                  ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷··
                  ·· · ·M· · ·I· · ·D· · ·I· · ·· ·· ·M· · ·A· · ·N· · ·I· · ·A· · ·C· · ·S· · ··
                  ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷·· ·· · · · ·· ··÷¦÷··

                  Comment


                    #10
                    Originally posted by Jaff View Post
                    Depends on compression used... Anyway, try PNG format instead of tiff Now who's smaller?
                    Yes ! You are right. Thanks

                    Comment

                    Working...
                    X