PIL reducing image size just by opening and savingpython PIL save image different size originalHow do I resize an image using PIL and maintain its aspect ratio?Twitter image encoding challengeSave plot to image file instead of displaying it using MatplotlibChanging image size in MarkdownPIL - Pasting/saving image as .jpgPIL Image resize compresses the image when is not expected topython PIL save image different size originalReduce image size in C#Why does the size of the jpg file reduce when we open and save an image using PIL in python?Trying to open image with PIL

Talk interpreter

Why is getting a PhD considered "financially irresponsible" by some people?

How to say "I only speak one which is English." in French?

Why does this London Underground poster from 1924 have a Star of David atop a Christmas tree?

Term used to describe a person who predicts future outcomes

Videos of surgery

Can a DM change an item given by another DM?

Defending Castle from Zombies

How to pass 2>/dev/null as a variable?

Find feasible point in polynomial time in linear programming

What are the IPSE’s, the ASPE’s, the FRIPSE’s and the GRIPSE’s?

What to do about my 1-month-old boy peeing through diapers?

Is there a word or phrase that means "use other people's wifi or Internet service without consent"?

Are (c#) dictionaries an Anti Pattern?

Why does the `ls` command sort files like this?

How do we improve collaboration with problematic tester team?

What is the name of this plot that has rows with two connected dots?

Dual of a bimodule

Are there any to-scale diagrams of the TRAPPIST-1 system?

What is Soda Fountain Etiquette?

Is the Amazon rainforest the "world's lungs"?

Using a JoeBlow Sport pump on a presta valve

Fill NaN based on previous value of row

Is it unusual for a math department not to have a mail/web server?



PIL reducing image size just by opening and saving


python PIL save image different size originalHow do I resize an image using PIL and maintain its aspect ratio?Twitter image encoding challengeSave plot to image file instead of displaying it using MatplotlibChanging image size in MarkdownPIL - Pasting/saving image as .jpgPIL Image resize compresses the image when is not expected topython PIL save image different size originalReduce image size in C#Why does the size of the jpg file reduce when we open and save an image using PIL in python?Trying to open image with PIL






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg



from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")


When I checked the sizes of the files, they were like this:

nature.jpg -> 1.3 MB (13,28,902 bytes)

new_nature.jpg -> 636.4 kB (6,36,354 bytes)

Their image type and resolution both were same.

This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg

Can anyone tell me why is this happening ?










share|improve this question



















  • 1





    Possible duplicate of python PIL save image different size original

    – MFisherKDX
    Mar 27 at 20:26











  • Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.

    – Dan Mašek
    Mar 27 at 21:37

















0















I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg



from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")


When I checked the sizes of the files, they were like this:

nature.jpg -> 1.3 MB (13,28,902 bytes)

new_nature.jpg -> 636.4 kB (6,36,354 bytes)

Their image type and resolution both were same.

This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg

Can anyone tell me why is this happening ?










share|improve this question



















  • 1





    Possible duplicate of python PIL save image different size original

    – MFisherKDX
    Mar 27 at 20:26











  • Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.

    – Dan Mašek
    Mar 27 at 21:37













0












0








0








I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg



from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")


When I checked the sizes of the files, they were like this:

nature.jpg -> 1.3 MB (13,28,902 bytes)

new_nature.jpg -> 636.4 kB (6,36,354 bytes)

Their image type and resolution both were same.

This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg

Can anyone tell me why is this happening ?










share|improve this question














I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg



from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")


When I checked the sizes of the files, they were like this:

nature.jpg -> 1.3 MB (13,28,902 bytes)

new_nature.jpg -> 636.4 kB (6,36,354 bytes)

Their image type and resolution both were same.

This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg

Can anyone tell me why is this happening ?







python image compression python-imaging-library






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 20:24









trahultrahul

12 bronze badges




12 bronze badges










  • 1





    Possible duplicate of python PIL save image different size original

    – MFisherKDX
    Mar 27 at 20:26











  • Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.

    – Dan Mašek
    Mar 27 at 21:37












  • 1





    Possible duplicate of python PIL save image different size original

    – MFisherKDX
    Mar 27 at 20:26











  • Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.

    – Dan Mašek
    Mar 27 at 21:37







1




1





Possible duplicate of python PIL save image different size original

– MFisherKDX
Mar 27 at 20:26





Possible duplicate of python PIL save image different size original

– MFisherKDX
Mar 27 at 20:26













Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.

– Dan Mašek
Mar 27 at 21:37





Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.

– Dan Mašek
Mar 27 at 21:37












1 Answer
1






active

oldest

votes


















1















JPEG images can be compressed and saved in different qualities.
The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:



from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg", quality=95)


Read docomentishion here.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385851%2fpil-reducing-image-size-just-by-opening-and-saving%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    JPEG images can be compressed and saved in different qualities.
    The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:



    from PIL import Image
    im = Image.open("nature.jpg")
    im.save("new_nature.jpg", quality=95)


    Read docomentishion here.






    share|improve this answer





























      1















      JPEG images can be compressed and saved in different qualities.
      The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:



      from PIL import Image
      im = Image.open("nature.jpg")
      im.save("new_nature.jpg", quality=95)


      Read docomentishion here.






      share|improve this answer



























        1














        1










        1









        JPEG images can be compressed and saved in different qualities.
        The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:



        from PIL import Image
        im = Image.open("nature.jpg")
        im.save("new_nature.jpg", quality=95)


        Read docomentishion here.






        share|improve this answer













        JPEG images can be compressed and saved in different qualities.
        The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:



        from PIL import Image
        im = Image.open("nature.jpg")
        im.save("new_nature.jpg", quality=95)


        Read docomentishion here.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 22:51









        RealA10NRealA10N

        741 silver badge9 bronze badges




        741 silver badge9 bronze badges



















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385851%2fpil-reducing-image-size-just-by-opening-and-saving%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

            밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

            1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴