I have a raster dataset and have used gdal_sieve to eliminate clumps of pixels made up of below a certain number of pixels. How do I eliminate large clumps of pixels above a certain number of pixels?
gdal_sieve.py does not support removing objects above a threshold size. However it seems that your desired output can be achieved by sieving objects below your threshold and then calculating the difference between the input and sieved images:
gdal_sieve.py -st <<threshold>> input.tif sieved.tif
gdal_calc.py -A input.tif -B sieved.tif --calc="A ^ B" --outfile=output.tif