Magento 2 - Why is product image size & dimensions changed after upload?












1














When uploading new images to a product in Magento 2, it is not only decreasing the dimensions of the image, but it's increasing the image file size:



Image Details Before Upload




  • Dimensions: 1185 × 1580 px

  • File Size: 446 KB


After Upload



enter image description here



Can anybody explain why this is happening? I accept that some data may be added to the image by Magento, but I don't understand why it has been resized? Is there anywhere this can be changed?



EDIT



I've now discovered that the image dimensions have been set in vendor/magento/framework/File/Uploader.php



enter image description here



Next is to find the best way to change these values, I found this related post: Magento 2 change max image height and width of image uploader in Admin?



I still don't know why these dimensions have been imposed on users on M2. nor why the file size more than doubles in size!










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2




    Possible duplicate of Default uploading image size in Magento 2
    – LucScu
    Jun 26 '18 at 6:58
















1














When uploading new images to a product in Magento 2, it is not only decreasing the dimensions of the image, but it's increasing the image file size:



Image Details Before Upload




  • Dimensions: 1185 × 1580 px

  • File Size: 446 KB


After Upload



enter image description here



Can anybody explain why this is happening? I accept that some data may be added to the image by Magento, but I don't understand why it has been resized? Is there anywhere this can be changed?



EDIT



I've now discovered that the image dimensions have been set in vendor/magento/framework/File/Uploader.php



enter image description here



Next is to find the best way to change these values, I found this related post: Magento 2 change max image height and width of image uploader in Admin?



I still don't know why these dimensions have been imposed on users on M2. nor why the file size more than doubles in size!










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2




    Possible duplicate of Default uploading image size in Magento 2
    – LucScu
    Jun 26 '18 at 6:58














1












1








1







When uploading new images to a product in Magento 2, it is not only decreasing the dimensions of the image, but it's increasing the image file size:



Image Details Before Upload




  • Dimensions: 1185 × 1580 px

  • File Size: 446 KB


After Upload



enter image description here



Can anybody explain why this is happening? I accept that some data may be added to the image by Magento, but I don't understand why it has been resized? Is there anywhere this can be changed?



EDIT



I've now discovered that the image dimensions have been set in vendor/magento/framework/File/Uploader.php



enter image description here



Next is to find the best way to change these values, I found this related post: Magento 2 change max image height and width of image uploader in Admin?



I still don't know why these dimensions have been imposed on users on M2. nor why the file size more than doubles in size!










share|improve this question















When uploading new images to a product in Magento 2, it is not only decreasing the dimensions of the image, but it's increasing the image file size:



Image Details Before Upload




  • Dimensions: 1185 × 1580 px

  • File Size: 446 KB


After Upload



enter image description here



Can anybody explain why this is happening? I accept that some data may be added to the image by Magento, but I don't understand why it has been resized? Is there anywhere this can be changed?



EDIT



I've now discovered that the image dimensions have been set in vendor/magento/framework/File/Uploader.php



enter image description here



Next is to find the best way to change these values, I found this related post: Magento 2 change max image height and width of image uploader in Admin?



I still don't know why these dimensions have been imposed on users on M2. nor why the file size more than doubles in size!







magento2 product-images image-resizing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:55









Community

1




1










asked Mar 15 '17 at 15:21









Adam Moss

7291237




7291237





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2




    Possible duplicate of Default uploading image size in Magento 2
    – LucScu
    Jun 26 '18 at 6:58














  • 2




    Possible duplicate of Default uploading image size in Magento 2
    – LucScu
    Jun 26 '18 at 6:58








2




2




Possible duplicate of Default uploading image size in Magento 2
– LucScu
Jun 26 '18 at 6:58




Possible duplicate of Default uploading image size in Magento 2
– LucScu
Jun 26 '18 at 6:58










1 Answer
1






active

oldest

votes


















0














In the end I created a new theme to override the following two files where the restriction was added:




  • vendor/magento/module-cms/view/adminhtml/templates/browser/content/uploader.phtml

  • vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml


Within those files I hard coded the new max image sizes:



"maxWidth":3000,
"maxHeight":3000


This is the post I followed to achieve the override: https://magento.stackexchange.com/a/153968/191



Regarding the image file size I have not found a definitive answer as to why the size has more than doubled. This post had some insight however: https://stackoverflow.com/questions/14008524/why-smaller-png-image-takes-up-more-space-than-the-original-after-getting-resize






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2fmagento.stackexchange.com%2fquestions%2f164526%2fmagento-2-why-is-product-image-size-dimensions-changed-after-upload%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









    0














    In the end I created a new theme to override the following two files where the restriction was added:




    • vendor/magento/module-cms/view/adminhtml/templates/browser/content/uploader.phtml

    • vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml


    Within those files I hard coded the new max image sizes:



    "maxWidth":3000,
    "maxHeight":3000


    This is the post I followed to achieve the override: https://magento.stackexchange.com/a/153968/191



    Regarding the image file size I have not found a definitive answer as to why the size has more than doubled. This post had some insight however: https://stackoverflow.com/questions/14008524/why-smaller-png-image-takes-up-more-space-than-the-original-after-getting-resize






    share|improve this answer




























      0














      In the end I created a new theme to override the following two files where the restriction was added:




      • vendor/magento/module-cms/view/adminhtml/templates/browser/content/uploader.phtml

      • vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml


      Within those files I hard coded the new max image sizes:



      "maxWidth":3000,
      "maxHeight":3000


      This is the post I followed to achieve the override: https://magento.stackexchange.com/a/153968/191



      Regarding the image file size I have not found a definitive answer as to why the size has more than doubled. This post had some insight however: https://stackoverflow.com/questions/14008524/why-smaller-png-image-takes-up-more-space-than-the-original-after-getting-resize






      share|improve this answer


























        0












        0








        0






        In the end I created a new theme to override the following two files where the restriction was added:




        • vendor/magento/module-cms/view/adminhtml/templates/browser/content/uploader.phtml

        • vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml


        Within those files I hard coded the new max image sizes:



        "maxWidth":3000,
        "maxHeight":3000


        This is the post I followed to achieve the override: https://magento.stackexchange.com/a/153968/191



        Regarding the image file size I have not found a definitive answer as to why the size has more than doubled. This post had some insight however: https://stackoverflow.com/questions/14008524/why-smaller-png-image-takes-up-more-space-than-the-original-after-getting-resize






        share|improve this answer














        In the end I created a new theme to override the following two files where the restriction was added:




        • vendor/magento/module-cms/view/adminhtml/templates/browser/content/uploader.phtml

        • vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml


        Within those files I hard coded the new max image sizes:



        "maxWidth":3000,
        "maxHeight":3000


        This is the post I followed to achieve the override: https://magento.stackexchange.com/a/153968/191



        Regarding the image file size I have not found a definitive answer as to why the size has more than doubled. This post had some insight however: https://stackoverflow.com/questions/14008524/why-smaller-png-image-takes-up-more-space-than-the-original-after-getting-resize







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 23 '17 at 12:37









        Community

        1




        1










        answered Mar 16 '17 at 15:16









        Adam Moss

        7291237




        7291237






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2fmagento.stackexchange.com%2fquestions%2f164526%2fmagento-2-why-is-product-image-size-dimensions-changed-after-upload%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

            An IMO inspired problem

            Management

            Has there ever been an instance of an active nuclear power plant within or near a war zone?