我使用console.log()
创建了一个小图片,这个图片只有2种颜色(alpha +其他颜色),所以我想转入索引颜色模式。
完成图像后,我运行命令
imagemagick
生成的图像为169个字节。现在,当我使用convert file.png +dither -colors 2 file.png
打开图像时,我没有做任何更改,我只是将它作为.png导出到旧图像上,在“将图像导出为PNG”的窗口中我取消所有内容,并保持压缩级别在9点。
生成的图像为109个字节。这有什么不同?起初我以为它会是元数据或类似的东西,我试图从gimp
使用imagemagick
命令,但它保持图像为169字节。那么,它是因为压缩算法呢? -strip
使用什么压缩算法?如何使用gimp
复制该内容?
我想用imagemagick
这样做的原因是我可以自动完成这个过程,因为我打算在100多张图片上执行此操作。
编辑:
输出imagemagick
identify -verbose imagemagickfile.png
Image: ic_stage.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 176x176+0+0
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 4-bit
green: 8-bit
blue: 1-bit
alpha: 1-bit
Channel statistics:
Pixels: 30976
Red:
min: 0 (0)
max: 102 (0.4)
mean: 60.0126 (0.235343)
standard deviation: 50.1973 (0.196852)
kurtosis: -1.87106
skewness: -0.359086
entropy: 0.977354
Green:
min: 0 (0)
max: 150 (0.588235)
mean: 88.2538 (0.346093)
standard deviation: 73.8196 (0.289489)
kurtosis: -1.87106
skewness: -0.359086
entropy: 0.977354
Blue:
min: 0 (0)
max: 255 (1)
mean: 150.031 (0.588359)
standard deviation: 125.493 (0.492131)
kurtosis: -1.87106
skewness: -0.359086
entropy: 0.977354
Alpha:
min: 0 (0)
max: 255 (1)
mean: 150.031 (0.588359)
standard deviation: 125.493 (0.492131)
kurtosis: -1.87106
skewness: 0.359086
entropy: 0.977354
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 100.817 (0.395359)
standard deviation: 99.3306 (0.389532)
kurtosis: -1.05614
skewness: 0.476254
entropy: 0.977354
Alpha: none #00000000
Colors: 2
Histogram:
12751: ( 0, 0, 0, 0) #00000000 none
18225: (102,150,255,255) #6696FFFF srgba(102,150,255,1)
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)
Background color: srgba(255,255,255,1)
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 176x176+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2015-10-26T11:27:21+02:00
date:modify: 2015-10-26T11:27:21+02:00
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:IHDR.bit-depth-orig: 2
png:IHDR.bit_depth: 2
png:IHDR.color-type-orig: 3
png:IHDR.color_type: 3 (Indexed)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 176, 176
png:PLTE.number_colors: 3
png:sRGB: intent=0 (Perceptual Intent)
png:tRNS: chunk was found
signature: 219cc9a10e56ed2940dc1d92e37bec98d49d12c1bd5f2adfd2bcc91fd7b56f85
Artifacts:
filename: ic_stage.png
verbose: true
Tainted: False
Filesize: 218B
Number pixels: 31K
Pixels per second: 0B
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.2-0 Q16 x86_64 2015-08-18 http://www.imagemagick.org
identify -verbose gimpfile.png