2017-02-17 61 views
2

嘗試使用bash腳本和tiff2pdf製作一堆tiff到Web準備pdf,但我的測試套件出現了一個很奇怪的問題。當我ls -l ...Imagemagick識別-verbose報告與ls -l完全不同的文件大小

[email protected]:~/Desktop/testdir$ ls -l 
total 339896 
-rw------- 1 joe joe 2165668 Feb 17 11:48 191611032571.pdf 
-rw-rw-r-- 1 joe joe 28114948 Feb 17 11:51 1948010211.pdf 
-rw------- 1 joe joe 28114113 Feb 17 11:42 1948010211.tif 
-rw-rw-r-- 1 joe joe 29499021 Feb 17 11:51 1948010212.pdf 
. 
. 
. 

但是,如果我identify -verbose 1948010211.pdf ...

[email protected]:~/Desktop/testdir$ identify -verbose 1948010211.pdf 
Image: 1948010211.pdf 
    Format: PDF (Portable Document Format) 
    Class: DirectClass 
    Geometry: 1085x1456+0+0 
    Resolution: 72x72 
    Print size: 15.0694x20.2222 
    Units: Undefined 
    Type: PaletteAlpha 
    Endianess: Undefined 
    Colorspace: sRGB 
    Depth: 16/8-bit 
    Channel depth: 
    red: 8-bit 
    green: 8-bit 
    blue: 8-bit 
    alpha: 1-bit 
. 
. 
. 
    Properties: 
    date:create: 2017-02-17T14:30:11-08:00 
    date:modify: 2017-02-17T14:30:11-08:00 
    pdf:HiResBoundingBox: 1085.04x1455.84+0+0 
    pdf:Version: PDF-1.1 
    signature: b3d978e3b2e7784867b27da677b7288e6674dfcaeb92a8c58f9faf19b20f0655 
    Profiles: 
    Profile-icc: 2576 bytes 
     Description: Artifex Software sRGB ICC Profile 
     Manufacturer: Artifex Software sRGB ICC Profile 
     Model: Artifex Software sRGB ICC Profile 
     Copyright: Copyright Artifex Software 2011 
    Artifacts: 
    filename: 1948010211.pdf 
    verbose: true 
    Tainted: True 
    Filesize: 2.395MB 
    Number pixels: 1.58M 
    Pixels per second: 39.49MB 
    User time: 0.040u 
    Elapsed time: 0:01.040 
    Version: ImageMagick 6.7.7-10 2016-11-29 Q16 http://www.imagemagick.org 

任何想法,爲什麼文件大小會如此截然不同?我的bash腳本中的命令(tiff2pdf -u i -w 15.07 -l 20.22 -x 300 -y 300 -r o -o "${file/%.tif/.pdf}" "$file")有什麼問題,導致這樣一個大文件?

+0

我不熟悉'tiff2pdf',但懷疑'-x 300'和'-y 300'設置了x,y分辨率 - 可能試着將它們設置爲144以使尺寸減小一個因子4+。 –

+0

他們是。我已經轉向了一種將事情降低到一兆字節以下的新命令;我只是想知道爲什麼識別和ls會報告相同圖像的大小不同。 –

+0

@WilliamMcDuff:嘗試升級。過去有一個錯誤:http://www.multipole.org/discourse-server/viewtopic.php?t=20491#p81927。圖書館可能倒退了。 – saurabheights

回答

0

你可以認爲,在輸出identify -verbose觀察到的Filesize是誤導性的:它的BLOBrefers to the size使用in memory,它是從由文件所消耗的存儲量不同。

除非您需要identify -verbose命令生成的信息的其他部分,只需使用ls實用程序提供的文件大小即可。 (或者,如果您使用的是Mac OS X,則可能會使用另一個工具,如pdfinfoXpdf的一部分),或者甚至mdls,兩者都將報告PDF的文件大小。