In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to compress and optimize jpg and png pictures under Linux". In daily operation, I believe many people have doubts about how to compress and optimize jpg and png pictures under Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to compress and optimize jpg and png pictures under Linux". Next, please follow the editor to study!
Jpegotim compressed jpg Picture
Install jpegotim
If you have an epel yum source, use the following command
The code is as follows:
# yum install jpegoptim
Compress picture command
The code is as follows:
# jpegoptim ttlsa.jpg
Ttlsa.jpg 1425x823 24bit N JFIF [OK] 1074449-> 853514 bytes (20.56%), optimized.
You can see that ttlsa.jpg is automatically compressed by 20.56%.
Compress it again.
The code is as follows:
# jpegoptim ttlsa.jpg
Ttlsa.jpg 1425x823 24bit N JFIF [OK] 853514-> 853514 bytes (0.005%), skipped.
The picture has already been compressed, so the prompt is skipped and does not need to be compressed again.
Provide a batch compressed script
The code is as follows:
For i in / data/site/image.ttlsa.com/images/*.jpg; do jpegoptim $I; done
Pngcrush optimized PNG Picture
Project address: http://pmt.sourceforge.net/pngcrush/
The code is as follows:
# wget http://downloads.sourceforge.net/project/pmt/pngcrush/1.7.88/pngcrush-1.7.88.tar.gz
# tar-xzvf pngcrush-1.7.88.tar.gz
# cd pngcrush-1.7.88
# make
# cp pngcrush / usr/bin
Pngcrush uses syntax
The code is as follows:
Usage: pngcrush [options except for-e-d] infile.png outfile.png
Pngcrush-e ext [other options] file.png...
Pngcrush-d dir/ [other options] file.png...
Pngcrush-ow [other options] file.png [tempfile.png]
Pngcrush-n-v file.png...
Options:
-bail (bail out of trial when size exceeds best size found
-bit_depth depth (deprecated)
-blacken (zero samples underlying fully-transparent pixels)
-brute (use brute-force: try 148different methods)
. For more information, please read for help.
Pngcrush simple command
The code is as follows:
Pngcrush-brute-e "myimage_compressed.png" myimage.png
. Omit.
Best pngcrush method = 123 (ws 15 fm 4 zl 9 zs 1) = 124820
For output to ttlsattlsa_new.png
(1.63% critical chunk reduction)
(1.63% filesize reduction)
CPU time decoding 1.560, encoding 7.640, other 0.030, total 9.230 sec.
Batch optimization of PNG pictures
The code is as follows:
Pngcrush-brute-d "/ data/site/image.ttlsa.com/images" * .png
At this point, the study on "how to compress and optimize jpg and png images under Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.