Lack of interest Better compression of jpg preview images

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

otto

Well-known member
Hello,

today i look a litle bit on my site speed - and i see, a preview image (every!) in the Media Gallery will have a big file size, a to big file size:

A preview image in 150x150px will have 20 to over 30 kbyte in file size - that is realy to big.

So my suggestion for the media gallery is - pleas give us a option to reduce the saved quality of every preview pics to increase the file sizes for a faster page load. :)

Regards
 
Upvote 3
This suggestion has been closed. Votes are no longer accepted.
XMG saves jpg files with 100% quality - so, especialy for the thumbs, it would be better to save jpgs with 90-95% jpg quality to save disk space and traffic for a faster page load and smaller backups.

I believe in a XMG version bevor, we have a option to set this quality setting - but in 1.0.3 I dont can find anything like this.

I edit the core files to solve this for me:

for XenGallery 1.0.3
change JPG compression:
- /httpdocs/forum/library/XenGallery/Helper/Image.php
160
PHP:
public function resize($max_width, $max_height, $method = 'fit', $cropAreaLeftRight = 'c', $cropAreaBottomTop = 'c', $jpgQuality = 90)

348
PHP:
public function cropExact($x, $y, $width, $height, $jpgQuality = 90)
With this litle change XMG now saves me smaller jpg files as bevor so I think, why not a option in ACP for it? ;)
 
Hello,

I was trying to change the resize funciotn to $jpgQuality = 75 but the results are the same as with 90.
Shouldn't the image be smaller?

Thanks
 
Hello,

I was trying to change the resize funciotn to $jpgQuality = 75 but the results are the same as with 90.
Shouldn't the image be smaller?

Thanks
I dont own XFMG but i assume you would need to Rebuild something similer to Rebuild Attachment Thumbnails.. (ACP, Tools, Rebuild Caches, ???)
 
Hi,

Just tested uploading the same image twice .. one with 90 and the other with 75 and both have the same size.
They should have different sizes.

Thanks
 
Hmmm... here it works like it should. (Xenforo 1.4.8 and XFMG 1.0.6)

An other way can be, to use jpgtran on the linux console and a shell script (cron) to shrink every night the new jpegs.
But as I say - in my case it works just fine...
 
I 'mogrify'ed all images this weekend when I move from IPB to XF.
I was trying to get the most from the optimization from that function, but either with quality 50, 75 or 90 I get always the same size from the same image (133kb)

I even reset APC cache to force script update.

I tested with mogrify and I get with quality 50 81kb and with 75 121kb.

Why changing this value images are always the same size?

@Chris D maybe my questions should be moved to support. I didn't notice this topic was in the suggestions categroy
 
It's not really feasible to move suggestion threads so creating a new thread in the Support forum would be more appropriate. However, there's probably not a lot we can advise on this.

I don't have a particular explanation as to why the quality parameter isn't appearing to work but I can certainly confirm the same as otto - it is working as intended for me.

Just a bit of background info, on that; the quality parameter will only apply to JPG source images.

We don't pass it in to PNG, for example, because the default compression level of 6 (IIRC) is used and PNG compression is lossless so it should always produce a reasonable result quite speedily.

The quality parameter is fed directly into PHP's imagejpeg function. If you set that number to 50, the JPG quality will be 50. There's no code in between that would change that.

So ultimtely, this is suggesting that you're either using a PNG, there's some sort of caching involved, or you're hitting some weird bug in PHP somewhere that is for some reason ignoring the quality setting.
 
Hello Chris,

if you have Paint.NET in its latest Version and if you use the plugin "JPGoptim" and "PNGoptim" you can see what a realy good image compression can do. This both plugins shrink jpg and png image files much better than the default settings it can.

On server side, we have tools like "jpegtran" or "PNGquant" and "pngcrush" as realy good solutions - but its not used by xenforo or its add-ons.
Disk space costs not realy many money, but google looks since a longer time on pageload/pagespeed. And thats good for all. ;)
 
Top Bottom