【发布时间】:2014-12-24 16:35:24
【问题描述】:
我有一个带有 4 个波段的 PNG,但我只想要一个带有颜色表的波段。我尝试将它保存为 MS Paint 中的 256 色位图,它可以工作。
但我需要自动完成。我试过 ImageMagick:convert E8.png E8256.bmp,但没用。
原来的图片是这样的:
ImageMagick identify:
E8.png PNG 8250x4090 8250x4090+0+0 8-bit sRGB 231KB 0.000u 0:00.000
gdalinfo:
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
我想要一张带有一个波段和一个颜色表的图片,所以我用 MS Paint 打开 E8.png 并将其保存为 256 色位图。结果:
ImageMagick identify:
E8256.bmp BMP3 8250x4090 8250x4090+0+0 8-bit sRGB 256c 33.75MB 0.265u 0:00.138
gdalinfo:
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 我得到:
ImageMagick identify:
E8imagemagick.bmp BMP 8250x4090 8250x4090+0+0 8-bit sRGB 135MB 0.406u 0:00.409
gdalinfo:
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 Paint获得的BMP。
【问题讨论】:
-
很难说没有你的形象,但试试 ImageMagick
convert input.png -separate -type palette out%d.bmp -
谢谢我在问题末尾添加了 2 张图片。
-
恶意软件垃圾的可怕链接是什么?
-
嗯,它只是一个 png 和一个 bmp at upload.net 吗?我还添加了保管箱链接。很抱歉有任何混淆。
-
您的意思是 gdalinfo 所谓的“乐队”。我不了解所有其他图像处理软件,但 imagemagick 将其称为通道。 gdal 是 GIS 工具的集合,因此您可能是对的。
标签: imagemagick png bmp gdal