[英]Sliced tiff image gets bigger with python Wand
I have a .tif file that has 10 pages. 我有一个10页的.tif文件。 I want to create a sub-image containing only pages 2-7, but the produced file is much bigger than the orginal.
我想创建一个仅包含2-7页的子图像,但是生成的文件比原始图像大得多。 It should be smaller.
它应该更小。 What would you suggest?
你有什么建议? Here is my code:
这是我的代码:
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')
Original: 3mb 原稿:3mb
Sub: 50mb (!) 子:50mb(!)
EDIT: Here a sample source file : tif file 编辑:这里是一个示例源文件: tif文件
There's a lot at play in the TIFF file. TIFF文件中有很多内容。 Try the following in the command line.
在命令行中尝试以下操作。
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
All options above match the original file except rows-per-strip
. 上面的所有选项都与原始文件匹配,但
rows-per-strip
除外。 The original document has rows-per-strip
of 3507; 原始文档
rows-per-strip
为3507; which is not a multiple of 8 (don't know what impact that would have). 这不是8的倍数(不知道会产生什么影响)。
The majority of the options are supported by wand , and should be implemented / respected in your calling script. wand支持大多数选项,并且应在调用脚本中实现/尊重这些选项。
For -define 'tiff:rows-per-strip=3504'
, see this answer . 对于
-define 'tiff:rows-per-strip=3504'
,请参见此答案 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.