I have a geotiff which I need to export as png or pdf using python only, not the python console inside QGIS. So the whole procedure of opening the PrintComposer, ideally adding colorbar and adjusting colormap, and exporting to pdf (or any image format) needs to be implemented in an external python script. The whole procedure needs to be fully automated, which is why it does not help to simply export from existing PrintComposer, for which there are plenty of questions already, at least explaining how to do it from the QGIS python console.

closed as off-topic by whyzar, PolyGeo Feb 7 '17 at 23:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I would write a python script that opens the geotiff with rasterio, plots it using matplotlib.pyplot.imshow, and export that figure to PDF, again with matplotlib. – Paul H Feb 7 '17 at 17:24