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
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
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!
Best 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:
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