【问题标题】:Imagemagick identify -verbose reporting drastically different file size from ls -lImagemagick identify -verbose 报告与 ls -l 截然不同的文件大小
【发布时间】:2017-02-17 22:37:47
【问题描述】:

尝试使用 bash 脚本和 tiff2pdf 将一堆 tiff 制作成网络就绪的 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") 中的命令是否有问题?

【问题讨论】:

  • 我不熟悉tiff2pdf,但怀疑-x 300-y 300 正在设置x、y 分辨率-也许尝试将它们设置为144 以将尺寸缩小一个因子4+。
  • 他们是。我已经切换到一个新命令,它可以将事情降低到 1 兆字节以下;我只是想知道为什么 identify 和 ls 会报告同一张图片的大小如此不同。
  • @WilliamMcDuff:尝试升级。过去有一个错误:multipole.org/discourse-server/viewtopic.php?t=20491#p81927。图书馆可能已经退步了。

标签: bash pdf imagemagick ubuntu-14.04 ls


【解决方案1】:

您可能会争辩说,在 identify -verbose 输出中观察到的 Filesize 具有误导性:BLOBrefers to the size 使用了 in memory,这与文件消耗的存储量不同。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-17
    • 2015-06-07
    • 1970-01-01
    • 2011-04-14
    • 1970-01-01
    • 2011-01-30
    相关资源
    最近更新 更多