-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Geospatial Development By Example with Python
By :

We can make our results even more visually appealing and informative if we can combine the colorized image with the shaded relief image. Again, since we are dealing with arrays, we may deduce that this kind of composition can be achieved by performing an arithmetic operation between the two arrays.
In image processing, this is called alpha blending. Basically, a transparency is applied to both of the images and then they are blended into a new one. In the next steps, we are going to create a function that performs this operation:
First, to avoid generating the shaded relief multiple times, let's save it on the disk and edit the if __name__ == '__main__':
block of the raster_data.py
file:
if __name__ == '__main__': raster_data = RasterData('output/dem.tif') raster_data.adjust_values().create_hillshade( 10, 60).write_image('output/shaded.png')
Run the code and check whether the image was correctly written on the disk.
Now, add the alpha_blend
method to the RasterData...
Change the font size
Change margin width
Change background colour