TransWikia.com

Converting Grayscale GeoTIFF to PNG using QGIS results in all black image

Geographic Information Systems Asked by ShynnSup on May 30, 2021

I have a GeoTIFF in QGIS that I created by merging some images inside QGIS.

I use Raster>Conversion>Translate. And save it as a PNG.
I then open the image in both, Photoshop and Windows Photo Viewer and it looks entirely black.

Anyway to solve this?

I would like to use the image to print/use it in a document.

Edit: Here is the gdal info:

Driver
GDAL provider
GTiff
GeoTIFF
Dataset Description
AREA_OR_POINT=Area
Band 1
STATISTICS_MAXIMUM=1079
STATISTICS_MEAN=252.34346333641
STATISTICS_MINIMUM=1
STATISTICS_STDDEV=118.63833194341
Dimensions
X: 5400 Y: 3600 Bands: 1
Origin
-63,-37.6667
Pixel Size
0.000277778,-0.000277778
No Data Value
0 
Data Type
UInt16 - Sixteen bit unsigned integer 
Pyramid overviews
Layer Spatial Reference System
+proj=longlat +datum=WGS84 +no_defs
Layer Extent (layer original source projection)
-63.0000010703059985,-38.6666649293319793 : -61.5000010691059984,-37.6666649285319792
Band
Band 1
Band No
1
No Stats
No stats collected yet 

2 Answers

Your raster is 16bit single band. You need to rescale to a rendered 3 band 8bit dataset.

  1. Add your raster to QGIS and use the layer properties -> symbology to get it looking like you want:

enter image description here

  1. Right click raster layer and select export -> save as...in the context menu. Change output mode to rendered image and tick Create VRT:

enter image description here

  1. Then use the Translate (convert format) tool to output a PNG, make sure you change output datatype to Byte:

enter image description here

  1. Output png displayed in image editing software:

enter image description here

Correct answer by user2856 on May 30, 2021

You can also use QGIS (or straight GDAL) to convert your GeoTIFF to a grayscale single band 8bit PNG so it will display efficiently in Photoshop and Windows Photo Viewer with no visual quality loss and a smaller file size.

In QGIS: Raster -> Conversion -> Translate enter image description here

Note the command if you want to script this to do in GDAL:

gdal_translate -ot Byte -of PNG -scale D:/16bit.tif D:/8bit.png

Answered by A. Mort on May 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP