裁剪后,tiff 的大小增加了近两倍

裁剪后,tiff 的大小增加了近两倍

我有一个 2544x3472 的 tiff 文件,其大小为 402960 字节。之后我使用 ImageMagick (Ubuntu) 裁剪了它:

convert "$path" -crop 2544x1850+0x0 -compress JPEG "${PWD}"/output/$filename

现在其大小为 762374 字节。为何以及如何减小其大小?

原始文件信息:

Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2544x3472+0+0
Resolution: 300x300
Print size: 8.48x11.5733
Units: PixelsPerInch
Type: TrueColor
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 11 (0.0431373)
max: 255 (1)
mean: 245.305 (0.961982)
standard deviation: 40.5159 (0.158886)
kurtosis: 16.454
skewness: -4.21124
Green:
min: 13 (0.0509804)
max: 255 (1)
mean: 246.888 (0.968189)
standard deviation: 36.9046 (0.144724)
kurtosis: 22.0061
skewness: -4.79686
Blue:
min: 17 (0.0666667)
max: 255 (1)
mean: 248.162 (0.973183)
standard deviation: 35.1016 (0.137653)
kurtosis: 26.3384
skewness: -5.26587
Image statistics:
Overall:
min: 11 (0.0431373)
max: 255 (1)
mean: 246.785 (0.967785)
standard deviation: 37.5749 (0.147352)
kurtosis: 21.027
skewness: -4.71691
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 2544x3472+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Orientation: TopLeft
Properties:
date:create: 2016-04-21T07:33:25+03:00
date:modify: 2016-04-20T14:54:59+03:00
jpeg:sampling-factor: 2x2
signature: 78c318002a84787caf29b0e49e527d5cc740ce37f95dd60d901f31c0126aef25
tiff:endian: lsb
tiff:photometric: YCBCR
tiff:rows-per-strip: 16
tiff:software: xsane
tiff:timestamp: 2016:04:20 14:54:59
Artifacts:
filename: page0001.tiff
verbose: true
Tainted: False
Filesize: 403KB
Number pixels: 8.833M
Pixels per second: 73.61MB
User time: 0.130u
Elapsed time: 0:01.120
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org

最终文件信息:

Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2544x1850+0+0
Resolution: 300x300
Print size: 8.48x6.16667
Units: PixelsPerInch
Type: TrueColor
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 5 (0.0196078)
max: 255 (1)
mean: 236.75 (0.928432)
standard deviation: 54.1507 (0.212356)
kurtosis: 6.55873
skewness: -2.85258
Green:
min: 12 (0.0470588)
max: 255 (1)
mean: 239.712 (0.940049)
standard deviation: 49.538 (0.194267)
kurtosis: 9.47418
skewness: -3.30128
Blue:
min: 10 (0.0392157)
max: 255 (1)
mean: 242.064 (0.949272)
standard deviation: 47.2908 (0.185454)
kurtosis: 11.7772
skewness: -3.66424
Image statistics:
Overall:
min: 5 (0.0196078)
max: 255 (1)
mean: 239.509 (0.939251)
standard deviation: 50.4075 (0.197676)
kurtosis: 8.98602
skewness: -3.24651
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 2544x1850+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Orientation: TopLeft
Properties:
date:create: 2016-04-21T09:49:12+03:00
date:modify: 2016-04-21T09:49:12+03:00
jpeg:sampling-factor: 2x2
signature: 713fe32fdb33161257f6836e2cc6c6a929be9003ac9c29f6fd12b5995850c084
tiff:document: /home/output/page0001.tiff
tiff:endian: lsb
tiff:photometric: RGB
tiff:rows-per-strip: 16
tiff:software: xsane
tiff:timestamp: 2016:04:20 14:54:59
Artifacts:
filename: page0001.tiff
verbose: true
Tainted: False
Filesize: 762KB
Number pixels: 4.706M
Pixels per second: 52.29MB
User time: 0.090u
Elapsed time: 0:01.089
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org

答案1

不要指定压缩类型,而是JPEG尝试使用选项Zip后的压缩类型-compress来进一步压缩输出文件,如下所示:

convert "$path" -crop 2544x1850+0x0 -compress Zip "${PWD}"/output/$filename  

这导致输出 .tif 文件的大小约为我使用的输入 .tif 文件的 70%。这说明您用作示例文件的 .tif 文件可能存在异常。尝试从TIFF 示例文件网页并检查原始图像的宽度和高度,然后再指定裁剪图像的新值。

笔记:对我的 .tif 文件使用 ImageMagick 的-quality选项不会导致输出 .tif 文件的大小发生变化,无论该选项的值如何-quality

相关内容