how to compress images on centos 7

Issues related to applications and software problems
Post Reply
h0feer
Posts: 16
Joined: 2016/11/21 11:43:54

how to compress images on centos 7

Post by h0feer » 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.

User avatar
TrevorH
Site Admin
Posts: 33223
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: how to compress images on centos 7

Post by TrevorH » 2017/02/05 14:07:14

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

h0feer
Posts: 16
Joined: 2016/11/21 11:43:54

Re: how to compress images on centos 7

Post by h0feer » 2017/02/05 15:35:14

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?

User avatar
TrevorH
Site Admin
Posts: 33223
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: how to compress images on centos 7

Post by TrevorH » 2017/02/05 15:48:32

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

mghe
Posts: 766
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: how to compress images on centos 7

Post by mghe » 2017/02/05 17:42:20

For png you can use : optipng or pngcrush, pngnq, pngquant. I recommend optipng. Go to 'optipng --help' to get more info of compressing.

h0feer
Posts: 16
Joined: 2016/11/21 11:43:54

Re: how to compress images on centos 7

Post by h0feer » 2017/02/05 17:47:09

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 ?

anaaqptqmhcxqehcpb
Posts: 2
Joined: 2022/04/22 20:38:58

Re: how to compress images on centos 7

Post by anaaqptqmhcxqehcpb » 2024/03/05 14:46:42

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

Post Reply