【问题标题】:Converting PDF to TIFF using Imagemagick, making portion of the page turning into black使用 Imagemagick 将 PDF 转换为 TIFF,使页面的一部分变成黑色
【发布时间】:2021-07-01 06:53:53
【问题描述】:

在尝试使用 Imagemagick 将 PDF 转换为 TIF Multipage 时,页面的某些部分变成黑色。

Version: ImageMagick 7.1.0-0 Q16 x86_64 2021-06-13 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(3.1)
Delegates (built-in): bzlib djvu fontconfig freetype jng jpeg lzma openexr pangocairo png tiff x xml zlib

Sample file

转换后的文件截图:

使用的命令:

/usr/local/bin/magick convert -debug "Blob" -density 600X600 Sample1.pdf -type Grayscale -compress Group4 -monochrome -quality 100 -depth 1 -units PixelsPerInch -define connected-components:area-threshold=3 -define connected-components:mean-color=true -define connected-components:8 Sample1.tif

我们怎样才能得到正确的转换图像?

【问题讨论】:

  • AFAIK,你的命令的以下所有部分都是不必要的convert-debug Blob-type grayscale-quality 100-units PixelsPerInch-define connected-components*
  • 即使我删除它们,Image 在 linux 环境中仍然会重新调黑。
  • IIRC,最近 IM 中的 TIFF 编码器出现了一个错误,所以可以尝试输出一个 PNG,然后(之后)输出一个 JPEG,看看是否是 TIFF 方面导致了问题。
  • 我的要求是将 PDF 转换为具有 Group4 压缩、300 DPI 和黑白图像的 TIFF。如果我使用差异压缩页面变黑。 PNG 和 JPEG 转换工作正常。

标签: imagemagick imagemagick-convert


【解决方案1】:

以下内容适用于 Imagemagick 7.1.0.2 Q16 和 libtiff 4.1.0。基本上,通过将背景设为白色并将其关闭来移除 Alpha 通道。

convert -density 300 Sample1.pdf -background white -alpha background -compress Group4 x.tiff

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-05
    • 2016-06-13
    • 2011-06-10
    • 2019-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多