[Qgis-user] Image orientation

Tony Spiess spiesspurchaser at outlook.com
Tue Mar 23 04:36:35 PDT 2021


Hi,
A very newbie, Zurich/Win10.
Imported my photos into QGIS, used Display <img src="file:///[% photo %]" width="350" height="250"/>, toggled Map Notes, added single label, all worked fine.
Except my photos are landscape but some are portrait.
QGIS strips out most of the photo metadata but leaves Fields "photo" (combined path and filename) and "rotation" which is either 90 or 0 amongst others. NB: QGIS put Fields Long then Lat but other GPS software expect Lat then Lon.
So as QGIS Expression has an IF THEN function is should be possible to check which "rotation" and change width and height accordingly.
But I know QGIS syntax is very picky, so cannot stumble in the dark trying to guess how the expression should go.
I guess something along the lines of:
<img src=if("rotate"=0, "file:///[% photo %]" width="350" height="250","file:///[% photo %]" width="250" height="350")/>
Can anyone please tell me what I need to change please.
Tony


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210323/d69e4b92/attachment.html>


More information about the Qgis-user mailing list