Depois de recortar tiff seu tamanho aumenta quase duas vezes

1

Eu tenho um arquivo tiff 2544x3472 e seu tamanho é 402960 bytes. Depois disso eu recortei usando ImageMagick (Ubuntu):

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

e agora seu tamanho é 762374 bytes. Por que e como diminuir seu tamanho?

Informações do arquivo original:

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

Informação do arquivo final:

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
    
por Pavel 21.04.2016 / 12:00

1 resposta

1

Em vez de especificar o tipo de compactação JPEG , tente usar o tipo de compactação Zip após a opção -compress para compactar o arquivo de saída mais da seguinte maneira:

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

Isso resultou em um arquivo .tif de saída que era aproximadamente 70% do tamanho do arquivo .tif de entrada que eu usei. Isso sugere para mim que pode haver algo incomum sobre o arquivo .tif que você usou como um arquivo de exemplo. Tente baixar um arquivo .tif diferente da página da Web Arquivos de exemplo TIFF e verifique a largura e a altura da imagem original antes de especifique os novos valores para cortar a imagem.

Observação: usar a opção -quality do ImageMagick com meu arquivo .tif não resultou em nenhuma alteração no tamanho do arquivo .tif de saída, independentemente do valor da opção -quality .

    
por 21.04.2016 / 12:31