0

I am trying to extract JPEGs from SID images using GDAL. I ran into a an issue where black lines were present and figured out that it was a nodata issue, so I added -src/dst/vrt nodata arguments and it stitched together properly but there are color distortions where the black lines used to be.

Here is what I am doing, using GDAL 10.1.1 packaged with QGIS:

Building the VRT from SID files

gdalbuildvrt -overwrite -srcnodata 0 -vrtnodata 0 -input_file_list C:\imaging_test\pa18.txt pa18.vrt

Warping into latlong projection (from NAD83 utm18)

gdalwarp -t_srs "+proj=latlong +datum=WGS84" -srcnodata 0 -dstnodata 0 -of vrt -overwrite pa18.vrt pa18_ll.vrt

Extracting the JPEG (subsection) from the VRT

gdal_translate -of jpeg -projwin -74.957684 40.176146 -74.880596 40.147794 pa18_ll.vrt pa_test_discol.jpeg

Here is what I am observing:

enter image description here

I am a programmer, and have limited experience with GIS issues.

  • 2
    It may be that SID files are compressed with a lossy method and nodata area is not just black pixels but also something close, like RGB: 0 0 1. Jpeg compression may introduce some colour to the output. Try uncompressed tif output for testing the latter theory. If the first theory is correct, you must convert SID files first into uncompressed tiffs with GDAL nearblack gdal.org/nearblack.html – user30184 Jun 17 '14 at 15:59
  • The same result happens when using tifs as an output format. What you said about lossy compression and near black values is most likely what is going on here. Unfortunately, the SID files are far to large to add the conversion step into my program. Right now, I am planning to tile from the zoomed SID image, then batch stitch/project smaller files. Thanks for your help. – Pat Jun 18 '14 at 12:34
  • Decompress two adjacent images into geotiffs, run nearblack and try to mosaic them. You are a programmer (I am not) so I believe that you want to understand what happens instead of guessing. It does not need to be your final workflow but knowing what really happens will make you feel good. – user30184 Jun 18 '14 at 12:43

Your Answer

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

Browse other questions tagged or ask your own question.