Re: writing raster files produces black tifs

Hobart, Geordie (NRCan/RNCan)

Hi Julius.


If I understand you correctly, this is a Arc question.

IFF the values exist in your output file. You can test by loading your results file in a new process and

Arc tries to display a byte file for values between 0-255, hence no contrast between 0 and 1. In Arc,  open the layer properties of your  new GTiff and adjust the display values under the symbology tab.  


If not and the results file is all zeros then it is probably and error in your code. I had a similar issue where I incorrectly set the value NBITS =1 when calling and on linux systems my output was empty.


Good luck.




From: <> On Behalf Of Julius Schmiedt
Sent: July 12, 2021 02:18
Subject: [rasterio] writing raster files produces black tifs


Hello everybody,

I´m quite new to rasterio and Python, but my task is, to produce binary raster files based on the information of sentinel2 satellite images (GTiff). Therefore I use Spyder IDE and the numpy.where() method to calculate new arrays and save them as GTiffs.

Although the output arrays contain 0 and 1 values, the output tif only shows black (in the shape of the original gtiff), if opened with standard image viewer or ArcGIS Desktop. Only if opened via Python script in Spyder, I am able to display the output tifs as expected (using method).

If anybody has an idea, what the problem might be, I would appreciate any help.


Julius Schmiedt
Wissenschaftliche Hilfskraft

Department Landschaftsökologie
Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
Permoserstraße 15 | 04318 Leipzig
Tel.: +49 341 235 - 1058
Email: julius.schmiedt@...

Join to automatically receive all group messages.