Page 1 of 1

how to compress images on centos 7

Posted: 2017/02/05 12:55:54
by h0feer
hello


i'm using centos 7 for my website and i tested my site with many tools and they say to compress images because of site slow loading


Is there any package that will compress images by specifying folder? or by using cron or any method?




Thanks
Regards.

Re: how to compress images on centos 7

Posted: 2017/02/05 14:07:14
by TrevorH
What sort of image files are you using? Almost all of them are already compressed so compressing them again will just waste cpu time. All jpeg, gif, png images are already compressed.

Re: how to compress images on centos 7

Posted: 2017/02/05 15:35:14
by h0feer
TrevorH wrote:What sort of image files are you using? Almost all of them are already compressed so compressing them again will just waste cpu time. All jpeg, gif, png images are already compressed.
Hi,


almost jpg and png images, i already used to compress using php code, but they still are big images and slow down my server on load


som i was reading about https://www.webmaster.net/tutorials/ins ... score.html

your idea?

Re: how to compress images on centos 7

Posted: 2017/02/05 15:48:32
by TrevorH
EPEL has jpegoptim-1.4.4-1.el7.x86_64

This is about recompressing your existing image files so that they take up less space so not really anything to do with httpd at all except that it's the guy reading them and delivering them.

Re: how to compress images on centos 7

Posted: 2017/02/05 17:42:20
by mghe
For png you can use : optipng or pngcrush, pngnq, pngquant. I recommend optipng. Go to 'optipng --help' to get more info of compressing.

Re: how to compress images on centos 7

Posted: 2017/02/05 17:47:09
by h0feer
TrevorH wrote:EPEL has jpegoptim-1.4.4-1.el7.x86_64

This is about recompressing your existing image files so that they take up less space so not really anything to do with httpd at all except that it's the guy reading them and delivering them.

This is about re compressing , this is what i need.. all users that will use my website to upload their ad's for sale will go to a folder that i need to re-compress them to make them loading fast for future use



what you think ?

Re: how to compress images on centos 7

Posted: 2024/03/05 14:46:42
by anaaqptqmhcxqehcpb
h0feer wrote:
2017/02/05 12:55:54
hello


i'm using centos 7 for my website and i tested my site with many tools and they say to compress images because of site slow loading


Is there any package that will compress images by specifying folder? or by using cron or any method?




Thanks
Regards.

Hello h0feer,

Install jpegoptim using EPEL:

Code: Select all

yum install jpegoptim 
It optimizes images without quality loss. For PNGs, optipng and pngquant are great for compression:

Code: Select all

yum install optipng pngquant
For Automate compression with a cron job script:

Code: Select all

bash
Copy code
jpegoptim --max=85 /path/to/images/*.jpg
optipng -o7 /path/to/images/*.png
This setup ensures images uploaded for ads are automatically optimized for fast loading.
or if you looking for third party image optimization tool such as jpeg compressor with instant delete option right after the compressed the file. I think this guy using same software.

This script based on CentOS 7.
Good luck