I have a geotiff image that rings in at about 290MB. However, once I smooth it using a gaussian filter I'm unable to get it back to that size, it ends up being 1720MB. The size isn't really the problem so to speak, it's that when I go to use gdal_contour it takes 200x as long to contour the smoothed image.
The reason that I'm smoothing the image to begin with is that gdal_contour on the original DEM/DSM gives me a lot of little islands from noise in the data and very circuitous contour lines. Once I smooth it, the islands disappear and the contour lines are less wild, but the file gets so large that now the contouring takes forever. here are my gdal commands:
Generate contours labeled with elevation at 1m intervals (takes about 90s)
gdal_contour -a elev -i 1 original-dsm.tif
Generate contours labeled with elevation at 1m intervals (takes about 18000s)
gdal_contour -a elev -i 1 smoothed-dsm.tif
I thought that maybe I could use
gdal_translate (with various options such as -co COMPRESS=DEFLATE -ot Int16 and others)
to convert the smoothed tif to a smaller size and thus make the contouring go faster, but I've been unable to find the right combination of compression and bit depth.
I've used imagemagick to inspect the files and the major discrepancy I notice is that the original-dsm.tif file has "Channel depth: gray: 1-bit" whereas the smooth.tif has "Channel depth: gray: 16-bit". I'm pretty sure that this is why it's taking so much longer to process and why the image file is so large. Another way I notice the manifestation of the same problem is that the Base Type of the original file (imagemagick identify command) is Bilevel, but the Base type of the smoothed tif is Grayscale.
Does anyone know how to change the channel depth using gdal_translate or something else? Keep in mind that this is georeferenced, and I can't afford to lose the georeferencing.