bash - Imagemagick recognize -verbose 报告的文件大小与 ls -l 截然不同

标签 bash pdf imagemagick ubuntu-14.04 ls

尝试使用 bash 脚本和 tiff2pdf 将一堆 tiff 制作成可用于 Web 的 pdf,但我的测试套件出现了一个非常奇怪的问题。当我 ls -l...

wmcduff@wmcduffscomp:~/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...

wmcduff@wmcduffscomp:~/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 “)这会产生这么大的文件?

最佳答案

您可能会认为在 identify -verbose 输出中观察到的 Filesize 具有误导性:它 refers to the size BLOB的使用过in memory ,这与文件消耗的存储量不同。

除非您需要由 identify -verbose 命令生成的信息的其他部分,否则只需使用 ls 实用程序提供的文件大小即可。 (或者,您可以使用其他工具,例如 pdfinfo ( Xpdf 的一部分),或者如果您使用的是 Mac OS X,甚至可以使用 mdls ,这两个工具都会报告 PDF 的文件大小) .

关于bash - Imagemagick recognize -verbose 报告的文件大小与 ls -l 截然不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42308570/

相关文章:

linux - 等待子shell进程完成

pdf - 如何使用 OpenSSL 对文件进行可信签名

ruby-on-rails - 为什么 Ruby open-uri open 在我的单元测试中返回一个 StringIO,而在我的 Controller 中返回一个 FileIO?

bash - 更改 ffmpeg 输出目录

linux - 使用 bash 将子目录扁平化并在文件名前加上目录名

bash - 如何将数组长度分配给bash中的变量

c++ - 提取 PDF 的不同修订版

mysql - 服务器端打印到PDF(MySQL --> image --> PDF ??)嵌入中文的问题

c - 如何传递参数?

imagemagick - 在 ImageMagick 中旋转同一个单词的单个字母