Convert 4-band image to single band with colorpalette
Posted: 2015-03-24T08:21:16-07:00
Hi,
I use Windows 7 (64 bit) and ImageMagick 6.9.0-Q16
I have a white PNG and gdalinfo says this about it:
I try this to convert it to single band:
and when I try gdalinfo on the output (J11.png) I have a single battle but the -type palette -colors 256 is being ignored (because it says ColorInterp=Gray)
I want the output to be like this (notice ColorInterp=Palette and Color Table under NBITS=1):
When I append several of "J1.pngs" together I have the output that I want but I dont want to append anything ^^
Edit: Btw here is the image to play with:http://i.imgur.com/PupYAYn.png
I use Windows 7 (64 bit) and ImageMagick 6.9.0-Q16
I have a white PNG and gdalinfo says this about it:
Code: Select all
D:\>gdalinfo J1.png
Driver: PNG/Portable Network Graphics
Files: J1.png
Size is 4950, 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 ( 4950.0, 0.0)
Lower Right ( 4950.0, 4090.0)
Center ( 2475.0, 2045.0)
Band 1 Block=4950x1 Type=Byte, ColorInterp=Red
Mask Flags: PER_DATASET ALPHA
Band 2 Block=4950x1 Type=Byte, ColorInterp=Green
Mask Flags: PER_DATASET ALPHA
Band 3 Block=4950x1 Type=Byte, ColorInterp=Blue
Mask Flags: PER_DATASET ALPHA
Band 4 Block=4950x1 Type=Byte, ColorInterp=Alpha
Code: Select all
D:\>convert J1.png -type palette -colors 256 J11.png
Code: Select all
D:\>gdalinfo J11.png
Driver: PNG/Portable Network Graphics
Files: J11.png
Size is 4950, 4090
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 4090.0)
Upper Right ( 4950.0, 0.0)
Lower Right ( 4950.0, 4090.0)
Center ( 2475.0, 2045.0)
Band 1 Block=4950x1 Type=Byte, ColorInterp=Gray]
Image Structure Metadata:
NBITS=1
Code: Select all
D:\>gdalinfo Row_A.png
Driver: PNG/Portable Network Graphics
Files: Row_A.png
Size is 49500, 4090
Coordinate System is `'
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 4090.0)
Upper Right (49500.0, 0.0)
Lower Right (49500.0, 4090.0)
Center (24750.0, 2045.0)
Band 1 Block=49500x1 Type=Byte, ColorInterp=Palette
Image Structure Metadata:
NBITS=1
Color Table (RGB with 2 entries)
0: 255,255,255,255
1: 255,255,165,255
Edit: Btw here is the image to play with:http://i.imgur.com/PupYAYn.png