1

I have designed different layout templates with a couple of logos (pictures) in QGis 3.12.0, in order to share these with some project partners. The maps can be loaded via PostgreSQL database connection. The problem is that the logo-files (picture.jpeg) are loeded from my local computer and get lost when the project partners are loading the qps-file or there own local Qgis-project. Is there a way to embedd the pictures in the layout file?

3
  • 1
    AFAIK, there isn't any way to embed images into the layout (that aren't already part of the QGIS installation, like the north arrow svgs). You need to send them the qgs file bundled with the images in a location within the project folder, and have the image paths in map layout point to the location using an expression like @project_folder||'\\images\\name_of_image.jpg' That way it will look for those images no matter where the project is saved (so no worries if it's C:\Users\You ... or C:\Users\OtherPerson ....)
    – she_weeds
    Commented Apr 1, 2020 at 23:48
  • I tried but am still not successful. I stored all the files in the project folder c:\project\logos\logo1.jpg. The Qgis project is in the folder project. When I give the file above for image source it works well. What is the correct link for a related file? '\logos\logo1.jpg' or '\\logos\\logo1.jpg' doesn´t work.
    – oppia04
    Commented Apr 6, 2020 at 12:46
  • 1
    o.k. i tried a bit mor and found the easy solution...just 'logos/logo1.jpg' worked for me ..thanks!
    – oppia04
    Commented Apr 6, 2020 at 13:11

2 Answers 2

4

If you use data URI, you can embed your image into a html frame :

<img width="409" height="53" alt="GIS SE Logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABPgAAAClCAYAAADBGEOgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU[...]/XpC74hvPwHYtTmYxtNiHNODPP4+d6Yxqsp94bVw9mBpAB0kN+FoC+wVv0AyeMods734217+P8u1hzyOLfc5Hbu/q+59sq8+1ERERERERERGSi+S/RQier1opVngAAAABJRU5ErkJggg==">

or use directly the SVG path :

<svg width="409" height="53" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="99.33%" y1="41.9%" x2=".66%" y2="58.08%" id="a"><stop stop-color="#FFF" offset="0%"/><stop stop-color="#FFFEFD" offset="29%"/><stop stop-color="#FFFBF5" offset="44%"/><stop stop-color="#FFF5E8" offset="55%"/><stop stop-color="#FEEDD5" offset="65%"/><stop stop-color="#FEE3BC" offset="74%"/><stop stop-color="#FDD79E" offset="82%"/><stop stop-color="#FCC879" offset="90%"/><stop stop-color="#FBB751" offset="97%"/><stop stop-color="#FBB040" offset="99%"/></linearGradient>[...]0-5.9-2.53-5.9-5.83zm2.27-1.16h5.92c-.07-1.96-1.26-2.97-2.67-2.97-1.62 0-2.94 1.1-3.25 2.97zM377.5 34v-1.65h1.74v-7.37c0-.3-.17-.46-.48-.46h-1.37v-1.65h2.51c.95 0 1.41.42 1.41 1.23v.57c0 .35-.07.64-.07.64h.05a4.6 4.6 0 0 1 3.96-2.7c1.78 0 2.88.8 3.25 2.61h.05a4.49 4.49 0 0 1 3.98-2.62c2.46 0 3.63 1.43 3.63 4.27v5.48h1.76V34h-3.9v-6.67c0-1.56-.28-2.79-1.95-2.79-2.1 0-3.28 2.13-3.28 4.33v3.48h1.74V34h-3.87v-6.67c0-1.45-.22-2.79-1.94-2.79-2.11 0-3.34 2.24-3.34 4.42v3.39h1.76V34h-5.64zm21.48-2.4v-1.19h1.87v.73c0 .95 1.32 1.39 2.55 1.39 1.25 0 2.24-.51 2.24-1.43 0-1.13-1.23-1.48-2.77-2.03-1.65-.61-3.48-1.36-3.48-3.39 0-2.2 2.18-3.08 4.12-3.08 1.56 0 3.85.62 3.85 2.25v1.34h-1.87v-.73c0-.68-.88-1.14-1.96-1.14-1.06 0-1.98.44-1.98 1.34 0 1.06 1.23 1.5 2.57 1.96 1.72.57 3.68 1.3 3.68 3.37 0 2.1-1.94 3.27-4.47 3.27-2.02 0-4.35-.9-4.35-2.66z" fill="#6D8592"/></g></svg>

For the base64, if you have a "raster" logo, find an online base64 converter or play with base64 converter in some languages like base64 in Python.

For SVG path, open your SVG with your web navigator and show the source code.

In both methods, you can adjust the size with width="409" height="53".

1
  • 1
    Wow. That's pretty cool. Will have to try it out.
    – HeikkiVesanto
    Commented Apr 2, 2020 at 9:55
4

Not sure in which version it was introduced, but in 3.16 there is the possibility to specifically embed a file from the image selector dropdown in the layout context menu:

Embed

1
  • I dealed with the same problem. To embed the image within the layout was the solution I was looking for, thanks!
    – danceb
    Commented Sep 19 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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