This is just intriguing while not blocking my way, but I wonder what is going on and would like to get feedbacks from more experienced users.

1) Given a trans.png file (1.1MB) looks good and conserve transparencies (Stackexchanges displays below an altered version as .jpg) :

enter image description here

2) I restore georeferencing using :

gdal_translate -a_ullr 67.0 37.5 99.0 27.0 -co COMPRESS=LZW  -co ALPHA=YES       ./trans.png ./trans.gis.tif

3) The output trans.gis.tif (1.6MB) looks good and conserve transparencies (Stackexchanges displays below an altered version as .jpg):

enter image description here

4) Loading it in Quantum GIS, it get well positionned (georeferencing works!), but the image is ill colored with the darkest areas (and only them!) becoming green :

enter image description here

Is this green artifact normal ? How to fix it (so I may see the expected black pixels) ?

Edit: file added in 1)

  • Can you add the style tab of the layers properties? Setting the extent from 2%/98% to exact full might help. – AndreJ Jan 1 '15 at 11:04
  • @AndreJ: I added in 1) a link toward the source png for testing. – Hugolpz Jan 1 '15 at 16:16

It seems that the source file is a one-band file, which is transformed into a 3-band tif file. You can improve that using -expand rgba in the gdal_translate command.


Looking into the downloadable file you offer, it has two bands: one gray and one alpha. QGIS does not read the colour interpretation, and thinks it should be displayed as 3-channel-RGB.

Try this GDAL command line:

gdal_translate -a_srs EPSG:4326 -a_ullr 67.0 37.5 99.0 27.0 -b 1 -b 1 -b 1 -b 2 -co COMPRESS=LZW  -co ALPHA=YES trans.png transgis.tif

to get a working 4-channel RGBA tif file, which is handled by QGIS correctly without manual setting of CRS or style.

| improve this answer | |
  • Still same in QGIS: green pixels are all around. Note: I added the source png in 1), and there is the command to reinject georeferencing. – Hugolpz Jan 1 '15 at 16:16

A display fix is to do :

QGIS > Layers tab : right click > properties > style tab Band rendering > Rendering type : Singleband grey (choose that!)

enter image description here

I thereby doesn't really answer the "why" and "how to fix [the file]". If anyone knows....

| improve this answer | |
  • See my extended answer. The file is not broken, two-band-files are just not expected by QGIS. – AndreJ Jan 1 '15 at 19:04

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.