4

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 
1
  • Edited. I hope it Is the right information you requested.
    – ShynnSup
    Commented Aug 17, 2019 at 2:03

2 Answers 2

7

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

8
  • The OP values range from 1 to 1079. But an 8-bit image can only store values up to 255. Therefore, won't thete be clipping by outputting as 8 bits?
    – Stu Smith
    Commented Aug 18, 2019 at 4:04
  • @stusmith, no because the raster is rescaled and then exported rendered
    – user2856
    Commented Aug 18, 2019 at 4:07
  • OK, I see that it's not clipped. However, by rescaling aren't you "compressing" (is that the correct word?) 1079 values into 255? And thus the transition between pixels is not as smooth?
    – Stu Smith
    Commented Aug 18, 2019 at 23:30
  • @stusmith Yes but not visually. What the OP will get will be what is displayed in their GIS software. It's a standard technique for display. Your GIS does this by default to display rasters on the map canvas. If you read the original question - the output PNG is for "print/use it in a document"
    – user2856
    Commented Aug 19, 2019 at 0:20
  • 1
    @A.Mort The VRT output doesn't work for me in the latest version of QGIS (3.12) for some reason, but outputting a rendered GeoTIFF results in a 3 band 8 bit raster which I can then convert to PNG.
    – user2856
    Commented Jun 3, 2020 at 21:15
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.