Bug report #20038
mapCanvas.saveAsImage('path') adds a red cross to the image
|Affected QGIS version:||3.3(master)||Regression?:||Yes|
|Operating System:||Linux and Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||27860|
While exporting a series of images for an animation with the TimeManager plugin I noticed a red cross in the exported images. The red cross was put at the 0,0 coordinate regardless of the projection system used. It was not there when exported through the menu (file>export>save map as image) but only when using the TimeManager. IT did not matter if I used Linux or Windows, nor did it matter if I used QGIS 3.0, 3.2 or 3.3 At first I thought it was a bug in TimeManager and as such reported it there[[https://github.com/anitagraser/TimeManager/issues/261]].
However while going through their code I couldn't see anything that might cause the red cross to appear. So I went to the mapCanvas().saveAsImage function in QGIS and I noticed that it did have a translate function that had little to do with the map image but apparently with annotations: [[https://qgis.org/api/qgsmapcanvas_8cpp_source.html#l00767]]
That line has this function call painter.translate( itemScenePos.x(), itemScenePos.y() ); which I can easily see putting a default image at 0,0 if it doesn't have an itemScenePos but still is called for some reason. (I don't know enough C++ and/or QGIS code to really understand what is going on there).
To test this I made a very simple map of just the coastline from Natural Earth data and used the python console to export the image through the python API: [[https://twitter.com/stvno/status/1048560517277798400]]