我有一个有4个波段的PNG,但我只想要一个带彩色桌子的带子。我试着把它保存为MS油漆中的256色位图,它起了作用。
但我得自动做。我尝试了ImageMagick:convert E8.png E8256.bmp,但是它没有工作。
这是原图:
identify**:** ImageMagick
E8.png PNG 8250x4090 8250x4090+0+0 8-bit sRGB 231KB 0.000u 0:00.000gdalinfo:
Driver: PNG/Portable Network Graphics
Files: E8.png
Size is 8250, 4090
Coordinate System is `'
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 4090.0)
Upper Right ( 8250.0, 0.0)
Lower Right ( 8250.0, 4090.0)
Center ( 4125.0, 2045.0)
Band 1 Block=8250x1 Type=Byte, ColorInterp=Red
Mask Flags: PER_DATASET ALPHA
Band 2 Block=8250x1 Type=Byte, ColorInterp=Green
Mask Flags: PER_DATASET ALPHA
Band 3 Block=8250x1 Type=Byte, ColorInterp=Blue
Mask Flags: PER_DATASET ALPHA
Band 4 Block=8250x1 Type=Byte, ColorInterp=Alpha我想有一个带和一个彩色表的图片,所以我打开E8.png与MS油漆,并将它保存为256彩色位图。结果:
identify**:** ImageMagick
E8256.bmp BMP3 8250x4090 8250x4090+0+0 8-bit sRGB 256c 33.75MB 0.265u 0:00.138gdalinfo:
Driver: BMP/MS Windows Device Independent Bitmap
Files: E8256.bmp
Size is 8250, 4090
Coordinate System is `'
Origin = (-1890.000000000000000,1890.000000000000000)
Pixel Size = (3780.000000000000000,-3780.000000000000000)
Corner Coordinates:
Upper Left ( -1890.000, 1890.000)
Lower Left ( -1890.000,-15458310.000)
Upper Right (31183110.000, 1890.000)
Lower Right (31183110.000,-15458310.000)
Center (15590610.000,-7728210.000)
Band 1 Block=8250x1 Type=Byte, ColorInterp=Palette
Color Table (RGB with 256 entries)
0: 0,0,0,255
1: 128,0,0,255
...
255: 255,255,255,255但是当我尝试convert E8.png E8imagemagick.bmp时,我得到了:
identify**:** ImageMagick
E8imagemagick.bmp BMP 8250x4090 8250x4090+0+0 8-bit sRGB 135MB 0.406u 0:00.409gdalinfo:
Driver: BMP/MS Windows Device Independent Bitmap
Files: E8imagemagick.bmp
Size is 8250, 4090
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 4090.0)
Upper Right ( 8250.0, 0.0)
Lower Right ( 8250.0, 4090.0)
Center ( 4125.0, 2045.0)
Band 1 Block=8250x1 Type=Byte, ColorInterp=Red
Band 2 Block=8250x1 Type=Byte, ColorInterp=Green
Band 3 Block=8250x1 Type=Byte, ColorInterp=Blue编辑:这里(uploaded.net- Dropbox)是最初的PNG,这里(uploaded.net -- dropbox)是我用MS涂料获得的BMP。
发布于 2014-12-24 18:51:57
也许这个命令:
convert E8.png -colors 256 E8-256colors.bmp让你更接近你想要的?虽然这个位图有点大..。(129 MByte)。所以这个应该更小:
convert E8.png -type palette -colors 256 E8-palette-256colors.bmp最后一个只有16 MByte。
你的标题上写着“任何格式”,所以PNG可能也是合适的吗?它所产生的输出要小得多:
convert E8.png -type palette -colors 256 E8-palette-256colors.png(现在的尺寸只有122个kByte。)
您的原始图像只包含6种颜色,您的新输出也是如此:
identify -format "%f: %k\\n" E8.png E8-palette-256colors.png
E8.png: 6
E8-palette-256colors.png: 6或
identify E8.png E8-palette-256colors.png
E8.png PNG 8250x4090 8250x4090+0+0 8-bit sRGB 231KB 0.000u 0:00.000
E8-palette-256colors.png[1] PNG 8250x4090 8250x4090+0+0 8-bit sRGB 6c 125KB 0.000u 0:00.000发布于 2014-12-24 18:54:07
不知道你到底想要什么..。
convert E8256.bmp -separate -type palette PNG8:out%d.pnghttps://stackoverflow.com/questions/27639782
复制相似问题