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.
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