annedi Posted July 31, 2023 Posted July 31, 2023 My website is a photography website. So photo quality is important to us, but naturally there are constraints on what can be achieved. We do ask users to resize their images prior to uploading, but I do not have any restrictions on image size for save or for display set. (We are a very small forum, so if a members forgets to resize an image we ask them to fix that or we resize it for them.) I recently tested changes to uploaded JPG files. We are using GD with JPG and WebP Quality = 100. Any uploaded JPG file is altered as compared to the original JPG. The quality of the image is slightly decreased. Why is that? I had thought that setting JPG Quality = 100 would prevent such changes?
Marc Posted August 1, 2023 Posted August 1, 2023 Check in System>Settings>Posting to see if you have "Maximum image dimensions to save" set.
annedi Posted August 1, 2023 Author Posted August 1, 2023 As mentioned, I do not have any restrictions set on image size for either saving or display.
Jim M Posted August 1, 2023 Posted August 1, 2023 Do you have an example of what you're seeing here? There may be some degradation of the file during any upload process but typically that is minimal.
annedi Posted August 2, 2023 Author Posted August 2, 2023 (edited) I would think that uploaded files of any type shouldn't change just from uploading? We often upload non-JPG files to share (via downloads) and they never change. Like PDFs or raw photo files like NEFs, TIFFs, ARWs and so forth. We detected the differences between the original JPG and the website JPG by layering the two files in Photoshop and setting the top layer to Difference. The Diff frame was pushed a bit using Auto-Contrast because the JPG changes can be subtle if the original JPG was saved with high quality. Here is one example showing typical JPG compression changes around edges. I was testing here with a very large ((too large)), high quality file. I'll try to get another more reasonable upload change and post that later. These JPG changes are not of earth shaking importance, but being a photography website we really would like to know what is happening or how to prevent it. Edited August 2, 2023 by annedi
Jim M Posted August 2, 2023 Posted August 2, 2023 14 minutes ago, annedi said: I would think that uploaded files of any type shouldn't change just from uploading? It's a technical limitation of utilizing GD for upload processing. Things like PDFs, etc... that don't go through it would not be impacted by it.
annedi Posted August 2, 2023 Author Posted August 2, 2023 Does GD resample the upload? Is there someplace I see what happens in the code?
Marc Posted August 3, 2023 Posted August 3, 2023 I have tagged our developers so we can get a more technical response you are requiring here
Ryan Ashbrook Posted August 3, 2023 Posted August 3, 2023 16 hours ago, annedi said: Does GD resample the upload? Is there someplace I see what happens in the code? Yes, the file will be compressed. If you need less compression to happen, you can change this in your Admin CP > Files > Image Settings > JPG and WebP Quality. Setting that to 100 will provide the least amount of compression, however the image library (which is necessary for things like cropping, orientation, resizing, and so forth) may still alter the image slightly. You may also get better results by using ImageMagick, if you aren't already, however that would require your host to install it if it hasn't been already. Marc 1
annedi Posted August 3, 2023 Author Posted August 3, 2023 (edited) If you need less compression to happen, you can change this in your Admin CP > Files > Image Settings > JPG and WebP Quality. I already did that !! As reported above I have JPG quality = 100. I'll retry with ImageMagick. Currently it is not working, so it might need reinstallation with appropriate flags. 1) So nobody knows what PHP/Image function changes the quality? 2) Can the "Image library", GD, or ImageMagick be bypassed? (....probably not, but I'm curious anyway) Edited August 3, 2023 by annedi added 2nd question
Ryan Ashbrook Posted August 3, 2023 Posted August 3, 2023 Just now, annedi said: So nobody knows what PHP/Image function changes the quality? It would be the core of PHP doing any alterations, so would be out of our control in this case.
annedi Posted August 3, 2023 Author Posted August 3, 2023 ok. I'm looking at this PHP image function reference. Perhaps it would be useful to someone else who has a photography website. https://www.geeksforgeeks.org/php-image-processing-and-gd-functions-complete-reference/
Recommended Posts