Jump to content

Image resizing and compression


Gabriel Torres

Recommended Posts

Hi,

I am playing these days with:

Imagemagick: https://www.imagemagick.org (for resizing images)

Zopfli: https://github.com/google/zopfli (for compressing PNG)

Guetzli: https://github.com/google/guetzli (for compressing JPEG)

With incredible results. So I wonder if we could have in the future the support for these integrated with the platform, so when a user uploads an image, it is automatically resized and compressed. This way not only we save less disk space, but also the website gets faster.

Thanks,

Gabriel

Link to comment
Share on other sites

Imagemagick is already used, but it is not very good for optimisation. Zopfli I have no experience with as I don't have many pngs. Guetzli is VERY power hungry, you need very powerful server and probably it still won't be able to compress the images on the fly. There are external compression services that do a competent enough job, I have raised this question before, but alas there wasn't a lot of feedback. 

I do agree it is one of the weak spots of the suite, hopefully it is addressed soon. 

Link to comment
Share on other sites

@jair101 I believe Imagemagick is used for generating thumbnails and resizing images, with no compression settings enabled.

You are right for Guetzli. I am playing with it in the past couple days and processing takes forever, so what I will eventually do here is to create a script to be run from time to time (at least once a day) to compress the images that haven't been compressed yet. Even though it is power-hungry, it is way better than the other compressors available.

Alternatively to Guetzli, I also tried JpegOptim: https://github.com/tjko/jpegoptim

It is much faster than Guetzli and could be an option to compress the image immediately.

The only trouble I have now is to figure out how to update the file sizes inside the database... As I am running these scripts in the shell.

Also, take a look at this:

https://github.com/centminmod/optimise-images

Link to comment
Share on other sites

Yeah, I thought about the same. But if you compress once a day, that means that majority of people will still see the non-optimized picture, because most of the traffic happens right after the photo is posted. Thats why I think its best to have an integrated solution that compresses the image right after uploading. 

Jpegoptim I think its only loseless, I would prefer a reliable lossy alogirthm. I am yet to test the centminmod solution properly, but from what I see it just uses the imagemagick setting for lossy compression, it doesn't have the advanced algorithms of kraken.io and the other. 

What I am doing is using Cloudflare Pro plan that includes their Polish algorithm. Should be caching and optimising the image on first load. It kinda works, but its far from perfect. Check it out if you want, 20$ per month. 

Link to comment
Share on other sites

3 hours ago, jair101 said:

Thats why I think its best to have an integrated solution that compresses the image right after uploading.

I couldn't agree more and hence why I opened this topic, suggesting IPS to add this feature to the platform! :)

3 hours ago, jair101 said:

Jpegoptim I think its only loseless

It has a lossy option, you set the quality you want. The script I linked uses Imagemagick only to resize big images, the compression is done by other methods. It supports other compressors/optimizers. Unfortunately it is not compatible with Debian, so I wrote my own script.

3 hours ago, jair101 said:

What I am doing is using Cloudflare Pro plan that includes their Polish algorithm. Should be caching and optimising the image on first load. It kinda works, but its far from perfect. Check it out if you want, 20$ per month. 

Yep, we are using the Pro plan from CloudFlare for a few years now. It is a great investment. Still, I want to reduce the amount of space the files use in your server. We have plenty of HDD space available, but by reducing the overall size of our website the backup routines get faster and take up less space...

In fact, eva2000, the author of this script, was the one who suggested me taking a look at compression to improve my website. He provided me with a couple of very interesting links to discussions on how to improve the performance of the website by using image compression. Take a look, it is a very advanced topic but really interesting:

https://community.centminmod.com/threads/benefits-of-ngx_pagespeed.1032/

https://community.centminmod.com/threads/zopfli-optimization-literally-free-bandwidth.5516/

 

Link to comment
Share on other sites

On 9/7/2017 at 6:30 AM, Gabriel Torres said:

I couldn't agree more and hence why I opened this topic, suggesting IPS to add this feature to the platform! :)

It has a lossy option, you set the quality you want. The script I linked uses Imagemagick only to resize big images, the compression is done by other methods. It supports other compressors/optimizers. Unfortunately it is not compatible with Debian, so I wrote my own script.

Yep, we are using the Pro plan from CloudFlare for a few years now. It is a great investment. Still, I want to reduce the amount of space the files use in your server. We have plenty of HDD space available, but by reducing the overall size of our website the backup routines get faster and take up less space...

In fact, eva2000, the author of this script, was the one who suggested me taking a look at compression to improve my website. He provided me with a couple of very interesting links to discussions on how to improve the performance of the website by using image compression. Take a look, it is a very advanced topic but really interesting:

https://community.centminmod.com/threads/benefits-of-ngx_pagespeed.1032/

https://community.centminmod.com/threads/zopfli-optimization-literally-free-bandwidth.5516/

 

So you are saying we need an https://imagify.io/ for IPB? It works pretty well for WP, but I have not seen a similar service for IPB. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...