Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Getting Started with Linux system to learn: How to compress JPEG images on the command line     - CentOS6 5 Configure SSH password Free (Linux)

- Packages with Snort intrusion monitoring light (Linux)

- To install MySQL on Linux (Database)

- Deb package installation method under ubuntu (Linux)

- MySQL log from the library than the main library (Database)

- Linux basic introductory tutorial ---- regex basis (Linux)

- Use small network command to check whether PC Security (Linux)

- Mount and unloading disks under Linux (Linux)

- Linux folder and extract the differential file comparison techniques -rsync Magical (Linux)

- socket busy poll of Linux kernel 3.11 to avoid sleep switch (Linux)

- How Datadog monitor Nginx (Server)

- Win8 mount disk partitions under Ubuntu (Linux)

- The security administrator network analysis tools SATAN Introduction under Linux (Linux)

- Introduction to Linux system process monitoring tools (Linux)

- Linux systems dmesg command processing failures and system information collected seven usage (Linux)

- MySQL concat function is SQL injection (Linux)

- Modify Linux terminal prompt path length (Linux)

- Git version rollback (Linux)

- CentOS6 MongoDB connection solution can not break 1000 (Database)

- Empty password Linux operating system (Linux)

  Getting Started with Linux system to learn: How to compress JPEG images on the command line
  Add Date : 2018-11-21      
  Question: I have many digital cameras take photographs. I think before uploading to Dropbox, optimization and compression JPEG image. Is there any simple way to compress JPEG picture is not the loss of their quality?

Today photographing devices (such as smart phones, digital cameras) to shoot out of the picture resolution is growing. Even 36.3 million pixel Nikon D800 has been into the market, and this trend simply can not stop. Today, camera equipment and constantly improve the picture resolution, so we had to compress, and then upload it to have a storage limit, bandwidth limit of the cloud.

In fact, there is a very simple method here compressed JPEG image. One called "jpegoptim" command-line tool that can help you "lossless" beautification JPEG images, so you can compress JPEG pictures and without sacrificing their quality. In case your storage space and bandwidth budget is really very little, jpegoptim also supports "lossy" compression to adjust the image size.

If you want to compress PNG images, this reference guide example.

Installation jpegoptim

Ubuntu, Debian or Linux Mint:

$ Sudo apt-get install jpegoptim

$ Sudo yum install jpegoptim
CentOS / RHEL installation, first open the EPEL repository, and then run the following command:

$ Sudo yum install jpegoptim
Lossless compression jpeg image

In order to losslessly compress a JPG image, use:

$ Jpegoptim photo.jpg
photo.jpg 2048x153624bit N ICC JFIF [OK] 882178 -> 821064 bytes (6.93%), optimized.
Note that the original image is compressed image after covering.

If jpegoptim not lossless beautify the image, it will not cover:

$ Jpegoptim -v photo.jpg
photo.jpg 2048x153624bit N ICC JFIF [OK] 821064 -> 821064 bytes (0.00%), skipped.
If you want to protect the original image, using the "-d" parameter indicates the save directory

$ Jpegoptim -d ./compressed photo.jpg
Thus, the compressed image will be saved in ./compressed directory (with the same input file name)

If you want to protect the file modification time to create, use "-p" parameter. Such compressed image will be the same as the original image date and time.

$ Jpegoptim -d ./compressed -p photo.jpg
If you just want to see lossless compression not really want to compress them, use the "-n" parameter to simulate the compression and then it will show the compression ratio.

$ Jpegoptim -n photo.jpg
Lossy compression JPG image

In case you really need to be saved in the cloud space, you can also use lossy JPG image.

In this case, use the "-m " option, mass range 0-100. (0 is the best quality, 100 is the worst quality)

For example, 50% of the quality of the compressed image:

$ Jpegoptim -m50 photo.jpg
photo.jpg 2048x153624bit N ICC JFIF [OK] 882178 -> 301780 bytes (65.79%), optimized.
At the expense of the quality, you will get a smaller picture.

JPEG image compression more than once

The most common scenario is the need to compress multiple JPEG image files in a directory. To cope with this situation, you can use the following script.

#! / Bin / sh
# Compress all * .jpg files in the current directory
# Save ./compressed directory
# And the original file has the same modification date
for i in * .jpg; do jpegoptim -d ./compressed -p "$ i"; done
- Ubuntu installed Komodo editor by PPA (Linux)
- Oracle partition table data migration, process management automation (Database)
- PostgreSQL use pgpool achieve high availability (Database)
- Extended use of the swap file swap space on Linux (Linux)
- Disk partition MBR (Linux)
- VSFTPD Security (Linux)
- Puppet subcommands Introduction (Server)
- Oracle create a temporary table space group (Database)
- Safe learning through self-extracting package to achieve invasion (Linux)
- Lsblk command lists using Linux block device information (Linux)
- Depth understanding of the TCP protocol (Database)
- RedHat Linux 6.5 Enterprise Edition installation Redis 3.0.3 (Database)
- Several Methods of SSH Auto - login (Linux)
- NaSC using simple mathematical operations on Ubuntu and Elementary OS (Linux)
- Ubuntu and Derivative Edition users install LMMS 0.4.15 (Linux)
- ASP.NET 5 tutorial series (Server)
- Node.js v4.0.0 installation configuration on Ubuntu 14.04 / 15.04 (Linux)
- Unable to start the network after restart clone a virtual machine (Linux)
- Apache Kafka: the next generation of distributed messaging system (Server)
- Android code performance optimization tips (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.