我有一个10页的.tif文件。我想创建一个只包含第2-7页的子图,但生成的文件比原始文件大得多。它应该更小一些。你有什么建议?下面是我的代码:
from wand.image import Image
with Image(filename='test.tif') as original:
with Image() as sub_image:
sub_image.sequence.extend(original.sequence[2:7])
sub_image.save(filename='sub.tif')原稿: 3mb
Sub: 50mb (!)
编辑:这里是一个样本源文件:tif file
发布于 2016-03-19 01:08:50
在TIFF文件中有很多功能。在命令行中尝试执行以下操作。
convert 'test.tif[2-7]' \
-define 'tiff:rows-per-strip=3504' \
-colorspace YCBCR \
-alpha remove \
-auto-level \
-compress JPEG \
-endian LSB \
-depth 8 \
output.tif除rows-per-strip外,以上所有选项都与原始文件匹配。原始文档的rows-per-strip为3507;它不是8的倍数(不知道这会有什么影响)。
wand支持大多数选项,应该在您的调用脚本中实现/遵守这些选项。
有关-define 'tiff:rows-per-strip=3504',请参阅this answer。
https://stackoverflow.com/questions/36082558
复制相似问题