Linux commnad get JPEG Quality & jpegicc convert Quality

Linux commnad get JPEG Quality & jpegicc convert Quality

今天剛好遇到一個問題,小小的處理經驗在這裡分享一下。通常我們放在網路上的圖檔大多以JPG為主,其實還是得看是甚麼形式的圖片決定採用何種格式,但是大多照片使用JPG是很平常的,不過JPG的圖檔格式也有Quality的分別,品質越好檔案當然也越大,依照我自己的經驗法則之下,我覺得Quality 93是恰到好處的一個值,檔案不會太大,而且圖片也還算得上細緻!而圖檔的大小至少是Quality的一半左右。

最近女友跟我說她的部落格圖片都很慢,明明和我放一樣的空間,怎麼會有比較慢的道理,研究了一下之後發現,大多的圖片檔案Quality都是100,我整個要傻眼啦!難怪每張圖片都要花比較多的時間開啟,甚至會覺得圖片開啟的速度緩慢,這時候我就等花些時間找出到底有多少Quality 100的檔案,搜尋了一些轉檔用的指令,大多可以轉出不同Quality的檔案,不過都沒有顯示圖片Quality的功能;於是從php的功能開始翻起,發現頂多只是顯示EXIF資訊,或只是說將圖片轉檔時設定Quality,也是找不到可以直接顯示Quality的方法。

最後我又回歸到系統上的指令,安裝了ImageMagick的套件,裡面有一個指令是可以幫忙完成查詢JPG的Quality。

# rpm -ql ImageMagick

grep bin

/usr/bin/animate
/usr/bin/compare
/usr/bin/composite
/usr/bin/conjure
/usr/bin/convert
/usr/bin/display
/usr/bin/identify
/usr/bin/import
/usr/bin/mogrify
/usr/bin/montage

簡單的利用identify的指令就可以dump出整張圖片內的資訊,需要搭配-verbose的參數使用

# identify -verbose 123.jpg

grep Quality

  Quality: 100

我就用這樣的方式將9000多筆檔案帶入迴圈之內去判斷,一共捉到了6000多筆Quality 100的檔案,真是非常的誇張啊!抓到之後當然簡單的轉檔,系統上被我找到一個很簡單的指令jpegicc(屬於lcms色彩管理系統套件),將多筆檔案帶入迴圈批次轉檔!

# jpegicc -q 95 input.jpg output.jpg

6000個檔案原本超過1.2G,壓縮成Quality 95後減少了500MB之多,然後再同步到五台不同的主機,真是浩大的工程!不過identify已經算是比較好用的ˊ指令了,-verbose會dump出很多的資訊,在搜尋上會花上不少時間,但是至少解決的這次的困擾!

Linux commnad get JPEG Quality jpegicc convert Quality

Linux commnad get JPEG Quality jpegicc convert Quality 相關文章


參考內容推薦

jpegicc - Unix, Linux Command

jpegicc - Unix, Linux Command Manual Pages (Manpages) , Learning fundamentals of UNIX and Linux in simple and easy steps : ... To color correct from scanner to sRGB: jpegicc -iscanner.icm in.jpg out.jpg To convert from monitor1 to monitor2 To make a ...

Command-line Tools

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. ... To get started, lets identify an image in the JPEG format: ... 70x46+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 92 Orientation: ...

Converting JPEG colorspace (Adobe RGB to sRGB) on Linux

2009年5月3日 - You can use the ImageMagic -profile option: convert image.jpg -profile sRGB.icc ... @RafaelXavier where do you get sRGB.icc and adobe.icc from? ... This command will convert an image with a special color profile (i.e. Adobe RGB 1998) to one w

image manipulation

2013年8月14日 - I have a cmyk pdf that I am trying to convert to a RGB jpeg or png file but ... I am trying the following command but the colors change drastically ... 72 -profile "sRGB Color Space Profile.icm" -quality 100 out.jpg ... It would be

imagemagick - Linux batch conversion

2012年3月29日 - Try this instead: mogrify -quality 80% *.jpg ... Linux batch conversion: Change quality of jpg with convert but keep its name. No problem. ... convert command help: convert input-file [options] ...

command line - pdf to jpg without quality loss; gscan2pdf

When I convert a pdf file to bunch of jpg files using convert -quality 100 file.pdf page_%04d.jpg I have appreciable quality loss. However if I do the following, there is no (noticeable) quality current community chat Unix & Linux ...

How to reduce size of jpg images

I am converting eps images to jpg using the convert command, like this: convert.exe -format "jpg" -density 72x72 -quality 91 -resize 130x130 -background ... and what parameters can I tweak in convert to get the same conversion settings? ... You

How to compress JPEG images from the command line on Linux

2015年3月21日 - In fact, there is a way to compress JPEG images easily on Linux. ... photo.jpg 2048x1536 24bit N ICC JFIF [OK] 882178 --> 821064 bytes (6.93%), optimized. ... You will get a smaller image at the cost of reduced quality.

ubuntu

2011年12月23日 - I'm converting images from RGB to CMYK. ... The simple way to get this info is by using identify command of the ImageMagick Package, try: ... identify -verbose foo.jpg | grep Colorspace Colorspace: CMYK $ identify -verbose ... 0 Compres

Color profile problems while converting PDF to JPG

Converting does work, but on a Linux server the output is a bad quality JPG. ... For quality conversion of a CMYK PDF to RGB JPEG, make sure you have a ... If so, try this command: ... +profile '*' -profile USWebCoatedSWOP.icc -profile sRGB.icm im