I am trying to translate a large bitmap (60000 x 25000) with GDAL_Translate but it appears to corrupt the image. This works fine for smaller images but has strange results with larger ones.

I can view the image in WildBit viewer prior to translating and it has no corruption. After the translation the top of the image appears to be a repeat of the bottom of the image. Is there a way to prevent this?

I have tried the -co BIGTIFF=YES option and that has no effect.

My arguements:

gdal_translate.exe -of GTiff -a_nodata 0 --config GDAL_DATA "*data path*" -a_ullr tlX tlY brX brY -a_srs EPSG:3857 InputPath OutputPath

The end result

corrupted image

GDALInfo of input image

Size is 63264, 24960
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,24960.0)
Upper Right (63264.0,    0.0)
Lower Right (63264.0,24960.0)
Center      (31632.0,12480.0)
Band 1 Block=63264x1 Type=Byte, ColorInterp=Red
Band 2 Block=63264x1 Type=Byte, ColorInterp=Green
Band 3 Block=63264x1 Type=Byte, ColorInterp=Blue

GDALInfo of output image

Size is 63264, 24960
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
            SPHEROID["WGS 84",6378137,298.257223563,
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],
Origin = (-8500416.405268350600000,4435398.925636629600000)
Pixel Size = (0.149300716298692,-0.149018012050865)
Image Structure Metadata:
Corner Coordinates:
Upper Left  (-8500416.405, 4435398.926) ( 76d21'37.94"W, 36d58'24.22"N)
Lower Left  (-8500416.405, 4431679.436) ( 76d21'37.94"W, 36d56'48.10"N)
Upper Right (-8490971.045, 4435398.926) ( 76d16'32.49"W, 36d58'24.22"N)
Lower Right (-8490971.045, 4431679.436) ( 76d16'32.49"W, 36d56'48.10"N)
Center      (-8495693.725, 4433539.181) ( 76d19' 5.21"W, 36d57'36.17"N)
Band 1 Block=63264x1 Type=Byte, ColorInterp=Red
  NoData Value=0
Band 2 Block=63264x1 Type=Byte, ColorInterp=Green
  NoData Value=0
Band 3 Block=63264x1 Type=Byte, ColorInterp=Blue
  NoData Value=0
  • Is it like that when you zoom in? I've seen similar problems with bil files but it was only in the render (draw) and was fine when zoomed in. If it is still corrupt when you zoom in then the file has a bpw doesn't it? Try something like IView gd.tuwien.ac.at/graphics/irfantut/commopti.html and copy the bpw to tfw for georeference. – Michael Stimson Jul 4 '17 at 2:15
  • This also happens when I zoom in. As for the next point I am a little lost. What do you mean exactly? I have tried opening the file in IView but it is too big and has memory issues. – Ando Jul 4 '17 at 2:26
  • IView has command line options, it's been over 10 years since I used them but I do remember converting rasters that couldn't be opened by ArcINFO, you may need the IView shell extension or to run in batch mode as you are correct the image is too large to open. – Michael Stimson Jul 4 '17 at 2:31
  • @MichaelStimson Ok, so I still need you to elaborate what I am doing with the image in the command line. Sorry, I don't understand what you mean by "copy the bpw to tfw for georeference" – Ando Jul 4 '17 at 2:41
  • 1
    According to the IrfanView help document a command line would look like i_view32.exe c:\test.bmp /convert=c:\test.tif to Convert file: 'c:\test.bmp' to 'c:\test.tif' without GUI but the tif will not be a GeoTiff, when you copy the world file it will be a world tif; if you don't want to have pesky world files hanging around then you can convert with gdal_translate -of gtiff which will read world tiff and write a GeoTiff (with the geotransform inside the file).. it seems a bit long winded but considering you can do all of this in a batch file it just needs a bit of patience and HDD space. – Michael Stimson Jul 4 '17 at 3:22

For anyone interested the process I followed to overcome this issue was

  1. Run i_view64.exe with the following command

    i_view64.exe InputImage.bmp /convert=OutputImage.tif
  2. Run GDAL_Translate

    gdal_translate.exe -of GTiff -a_nodata 0 --config GDAL_DATA "*data path*" -a_ullr tlX tlY brX brY -a_srs EPSG:3857 InputPath.tif OutputPath.tif
  3. I then proceeded on to use GDALWarp.exe but that is beyond the issue here.

The output of this was a successfully geo-referenced image based on a large bitmap.

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.