This project is read-only.

Strange images when loading tif files - GDAL

Oct 8, 2011 at 1:56 AM

Hi all,

I got some strange images when loaded tif files using the DotSpatial release Oct 7 2011, Beta.

It seems that it read 3 band image as 256 colors.

Please see the images: >> a mid size tif image loaded in DemoMap and ArcGIS >> a big size tif image loaded in DemoMap and ArcGIS >> small size jpg image load error in DemoMap and loaded in ArcGIS

Does anyone are facing the same thing?

Oct 11, 2011 at 6:42 PM

In DemoMap you are looking at only one band, which has been displayed with high values with a yellow color and low values as green. We'll need to add a feature so that you can view all three (R,G,B) bands as a composite image.

Jan 13, 2012 at 6:50 PM

You should be all set in the latest version of DotSpatial. Be sure that you don't include the Gdal extension as it will provide different behavior.

Feel free to let us know your results!

Jan 13, 2012 at 8:53 PM

Great!!! I will test it!!!


May 10, 2012 at 4:18 PM

Hi mudnug,
I make the test, and it will works. Thank you very much.

Then if I would like to use in my project the GDAL Extension, I will see my geotiff file only in one band. Is it right?

Thank you again,


May 10, 2012 at 6:12 PM

Presently, that is the behavior in the GDAL Extension.

May 11, 2012 at 8:38 AM

Hi mudnug,
thank you, you are always very kind.

Then if I have a RGB geotiff aerial photo, and I load it using gdal extension I will see it always as 8 bit image. Is there some way to compose the three band inside DotSpatial starting from GDAL geotiff loading?


Best regards,


May 12, 2012 at 12:47 AM

The GDAL Extension needs some work and I've been looking at setting it up for reading larger files, but I'm not sure about this issue. Feel free to grab the source and look at GdalImage.cs. There are some methods like


that suggest it was intended to read (display) more than one band.

May 14, 2012 at 11:14 AM

Hi mudnug,
once again thank you.

I have downloaded MapWindow GIS, and I have added the same geotiff in MapWindow and in Demomap.exe; I'm using Demomap you have in DotSpatial 1.1 release with GDAL extension loaded.

As you can see here, both load properly my geotiff, and as you know Demomap load only one band and I have a 256 colors map.
The strange thing is that it seems that also MapWindow use a 256 color map, bat it uses colors much more similar to those of the originale RGB image.
Does MapWindows use GDAL extension? Is there some color method in dotspatial that I can use to adapt a 256 color map to a RGB image?

Thank you,



May 14, 2012 at 8:41 PM

DotSpatial's use of GDAL isn't up to par with MapWindow 4.x, yet. MapWindow uses GDAL, though the source is pulled into the ocx, instead of linking to it.

My guess is that MapWindow 4.x uses all three bands, where DotSpatial only uses one. The code probably needs to be modified to get the result you want.

May 15, 2012 at 8:50 AM

Hi mudnug,
ok, probably I will not use GDAL extension, I'm not a great developer.

Is there a way, without GDAL extension, to map no-data value in a RGB aerial photo?

Thank you,


May 15, 2012 at 11:05 AM

Hi mudnug,
I have solved.

In my project I use gdalwarp utility, I run this command:

gdalwarp -t_srs epsg:32633 -tps -dstnodata 0 -co COMPRESS=JPEG -co JPEG_QUALITY=80 -tr 0.5 0.5 input.tif output.tif

If I load the output image using GDAL extension, DotSpatial maps no-data value. If I remove GDAL extension it does not map properly no-data value.

I have changed my command in:

gdalwarp -t_srs epsg:32633 -tps -dstalpha -co COMPRESS=DEFLATE  -tr 0.5 0.5 input.tif output.tif

Now I load my output.tif as IImageData, and no-data value is properly mapped.

Thank you very very much,


Oct 25, 2013 at 8:39 AM
Edited Oct 31, 2013 at 2:50 AM
Hi mudnug....

when i use minimal, the map color is default/original. because in minimal not include GDAL extension


but when i use extended or DotSpatial release the map color is change color to brown like @evermar question.

how to change color map in GDAL Extention to default color?
so the color map is original, not brown. like dotspatial minimal. but dotspatial still include gdal extension.

help me

Thanks Alex


i found the code in GdalRasterProvider.cs , DataManager.DefaultDataManager.PreferredProviders.Add(extension, this); , i try to remove this code, and the color success to default color, but the coordinate x and y not match with the tif image.

how to change tif image with default color without change coordinate x and y?

EDIT i found rs.Scheme.ApplyScheme(ColorSchemeType.Valley_Fires, raster); . Valley_Fires is type color scheme, when i try to remove this the layer dissapear, how to change this color to default?

help me.