[gdal-dev] Set a PNG background transparent without flip
liglio.pessoal at nexxa.com.br
liglio.pessoal at nexxa.com.br
Mon Oct 10 08:08:09 PDT 2022
Hi,
I want to set an image PNG background to transparent. I do using gdalwarp,
but the image flips horizontally.
I am using a workaround, executing the gdalwarp command twice to flip back.
Can I set the background to transparent using just one command without flip
?
IMAGE ORIGINAL:
Driver: PNG/Portable Network Graphics
Files: 2022-09-25--18_46_27.png
Size is 400, 400
Metadata:
NODATA_VALUES=0 0 0
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 400.0)
Upper Right ( 400.0, 0.0)
Lower Right ( 400.0, 400.0)
Center ( 200.0, 200.0)
Band 1 Block=400x1 Type=Byte, ColorInterp=Red
NoData Value=0
Mask Flags: PER_DATASET NODATA
Band 2 Block=400x1 Type=Byte, ColorInterp=Green
NoData Value=0
Mask Flags: PER_DATASET NODATA
Band 3 Block=400x1 Type=Byte, ColorInterp=Blue
NoData Value=0
Mask Flags: PER_DATASET NODATA
COMMAND:
gdalwarp -of PNG -overwrite -srcnodata 0 -dstalpha -to
SRC_METHOD=NO_GEOTRANSFORM 2022-09-25--18_56_15.png
MI-2022-09-25--18_56_15.png
IMAGE MODIFIED (Background transparent and flipped)
Driver: PNG/Portable Network Graphics
Files: MI-2022-09-25--18_46_27.png
MI-2022-09-25--18_46_27.png.aux.xml
Size is 400, 400
Origin = (0.000000000000000,400.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.000, 400.000)
Lower Left ( 0.0000000, 0.0000000)
Upper Right ( 400.000, 400.000)
Lower Right ( 400.000, 0.000)
Center ( 200.000, 200.000)
Band 1 Block=400x1 Type=Byte, ColorInterp=Red
Mask Flags: PER_DATASET ALPHA
Band 2 Block=400x1 Type=Byte, ColorInterp=Green
Mask Flags: PER_DATASET ALPHA
Band 3 Block=400x1 Type=Byte, ColorInterp=Blue
Mask Flags: PER_DATASET ALPHA
Band 4 Block=400x1 Type=Byte, ColorInterp=Alpha
Regards,
Liglio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221010/a2211fef/attachment.htm>
More information about the gdal-dev
mailing list