0

I need to compress the file sizes of GeoTIFFs that are created when running the MapBasic application. In a .Net application, I transform the GeoTIFF into a compressed JPG using ImageMagick; which works perfectly. However, the original GeoTIFFs are required for sharing and download. Adding to the difficulty is that the existing resolution and dimensions must be maintained. I am trying to perform the compression within MapBasic so that an additional application just to compress the GeoTIFFs will not need to be created.

Here is a sample of the current code:

Save Window windowId As reportPath & imgFileName & ".tif" Type "GEOTIFF" Width 7.49826 Units "in" Height 9.5816 Unites "in" Resolution 1152
2

Can you call batch files from MapBasic? I compress GeoTIFFs externally, using a command like the following: gdal_translate -co COMPRESS=JPEG -co JPEG_QUALITY=%QUALITY% -co PHOTOMETRIC=YCBCR -co TILED=YES You need input & output filenames/paths after that, which I don't show here. %QUALITY% is a variable I set up earlier, use from 75 to 100. I'm using the gdal_translate that comes with QGIS.

| improve this answer | |
  • yes you cann call cmd's, so it should be possible to call gdal via MapBasic – sn1ks Aug 13 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.