1

I have QPT file witch has map item and logo item..

here is my code:

    canvas = QgsMapCanvas()
    QgsProject.instance().read(QFileInfo(projectqgs))
    bridge = QgsLayerTreeMapCanvasBridge(QgsProject.instance().layerTreeRoot(), canvas)
    bridge.setCanvasLayers()
    composition = QgsComposition(canvas.mapSettings())
    composition.loadFromTemplate(document, substitution_map)
    map_item = composition.getComposerItemById('map')
    map_item.setMapCanvas(canvas)

but then i need to set Image Source path to my logo item.. Of course i need something like this:

logo_item = composition.getComposerItemById('logo')

then what should i do? is there anycode similar to this:

logo_item.setImageSource(path_to_image)
3

The answer is :

logo_item.setPictureFile(path_to_image)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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