Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

eliminate small polygons of a PNG with gdal_sieve

$
0
0

I want to eliminate polygons wich consist of less than 3550 px in this PNG . I tried using gdal_sieve but there seems to be an error.

gdal_sieve -st 3550 E8.png -of PNG E8sieve3550_4.png
ERROR 6: GDALDriver::Create() ... no create method implemented for this format.

Traceback (most recent call last):
  File "C:PROGRA~1QGISBR~1bingdal_sieve.py", line 165, in <module>
    dst_ds.SetGeoTransform( src_ds.GetGeoTransform() )
AttributeError: 'NoneType' object has no attribute 'SetGeoTransform'

I also tried “PNG” instead of PNG and changed the order of the parameters..

Edit: I tried what user30184 suggested: leave out the -of PNG part so that the output is a .tiff picture. But the result is a bit strange.

Here ist the output of gdalinfo E8.png (which I used as the source image):

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

After eliminating the small polygons I would like to use “convert E8.png -type palette -colors 256 E8-palette-256colors.png” and than gdal_polygonize..


Viewing all articles
Browse latest Browse all 397

Trending Articles