MyBBHacks.com Plugins for  MyBB

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Medium-Size Image Quality / Scaling Issues
#1
I have “generate medium-sized images” turned on presently and “Reduce Image if Too Large” as well.

I had a user complain that her images looked washed out. I went and looked at the image that loads by default on the photo page, and when I clicked on the intermediate image, the color exploded. Thinking it was a “medium-sized image” setting issue, I turned that setting off and reloaded the page, and the default image was no longer washed out. And it was in fact an issue with the "medium-sized" image being washed out:

https://www.ponybytes.com/forum/gallery/...ztest.jpeg
https://www.ponybytes.com/forum/gallery/...ztest.jpeg

https://www.ponybytes.com/forum/gallery/..._45_2.jpeg
https://www.ponybytes.com/forum/gallery/..._45_2.jpeg

With “generate medium-sized image” turned off, however, users began to complain about distorted images. When I looked at an example, the default (that is, full-sized) image was in fact distorted. I believe the page was sizing the image down to both of the maximum ezGallery image display dimensions instead of scaling it:

https://ponybytes.com/other/misc/distorted.png (screen cap of distortion on page)
https://www.ponybytes.com/forum/gallery/...egacy.jpeg (undistorted)

My sample user said that her default photo page image started to load an undistorted "medium-sized image" after the setting was reenabled but my copy of the same image, uploaded while medium-sized image was off, remains distorted.

So I think I understand why “generated on the web” medium-sized images might be lower quality. But what I need to figure out is how I can adjust the settings so that I am getting full image vibrancy and pictures that are not distorted. Thanks in advance for any help.
Reply
#2
We use MyBB's generate thumbnail function currently. The default quality is at 75,%

Found in
inc\functions_image.php(21): function generate_thumbnail($file, $path, $filename, $maxheight, $maxwidth)
Code:
        switch($imgtype)
        {
            case 1:
                if(function_exists("imagegif"))
                {
                    @imagegif($thumbim, $path."/".$filename);
                }
                else
                {
                    @imagejpeg($thumbim, $path."/".$filename);
                }
                break;
            case 2:
                @imagejpeg($thumbim, $path."/".$filename);
                break;
            case 3:
                @imagepng($thumbim, $path."/".$filename);
                break;
        }

You would need to change imagejpeg($thumbim, $path."/".$filename);
To
imagejpeg($thumbim, $path."/".$filename,100);

100 keeps it the original quality
Like what I do? Support me at https://www.patreon.com/vbgamer45/
Reply
#3
I will override that function in a future update and set the default to be 100
Like what I do? Support me at https://www.patreon.com/vbgamer45/
Reply
#4
Thanks! Alas, I added '100' to that line and I've still got the same problem with vibrancy:

https://www.ponybytes.com/forum/gallery/...ztest.jpeg
https://www.ponybytes.com/forum/gallery/...ztest.jpeg
Reply
#5
Do an experiment for quick test.
Change imagejpeg
to
imagepng($thumbim, $path."/".$filename);

In both spots and see if any difference.
Like what I do? Support me at https://www.patreon.com/vbgamer45/
Reply
#6
I changed both instances of @imagejpeg to @imagepng and removed the '100' I put in earlier in this part of the code:

PHP Code:
else
                {
                    @imagejpeg($thumbim$path."/".$filename);
                }
                break;
            case 2:
                @imagejpeg($thumbim$path."/".$filename);
                break; 


With this change, the medium-sized image seems to render the colors correctly.

I put it back to imagejpeg and restored the '100,' though because I didn't know what it was doing to my galleries in the meantime (we have a corporate-sponsored event going on and people are uploading like mad). What have we just illustrated?
Reply
#7
That the JPG image function causes the loss versus the imagepng function
Like what I do? Support me at https://www.patreon.com/vbgamer45/
Reply
#8
Adjusted in latest update to use png and our own thumbnail function so you won't need to do mybb file edits

5.5.1
!Fixed who is viewing inside categories for both public/user galleries
!Fixed rating display on main categories inside the gallery was not showing the rating stars
!Fixed sorting inside main gallery categories.
!Image quality fix for jpeg image thumbnails/medium sized images set to 100 instead of default of 75 for jpg
Like what I do? Support me at https://www.patreon.com/vbgamer45/
Reply
#9
Thanks!

Boy that is bananas. Should I leave it at PNG? And how the heck does SmugMug get around this?

Alternatively, can I get the "non-medium," large images to scale themselves?
Reply
#10
Check above did an update so no longer needed to do the file edit.
Like what I do? Support me at https://www.patreon.com/vbgamer45/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)