4

I have >200 scanned maps for georeferencing (downloadable example). But as soon as I load them into the georeferencer in QGIS they appear rotated 90 degrees (E or W). Despite the rotation, when I try to georeference them, it fails to work every time. When I click on the 'rotation' button at the bottom of the Qgis GDAL georeferencer screen, it still fails to georeference correctly. If I resave the jpeg in picture viewer to the correct rotation, it still fails to georeference properly.

I have also tried rotating the image in Adobe Illustrator first to see if that fixes the problem, but sadly not. The only way it works is if I use the 'freehand georeferencer' and use the rotation tool, but as you can imagine it is much more time consuming.

I have no issues georeferencing any of my other maps which were not scanned so I am certain it is something to do with the metadata of the image, however I can't seem to figure out what I should do next.

Can anyone shed some light on how I can fix this?

6
  • 2
    Pics or it didn't happen.
    – Erik
    Commented Feb 23, 2022 at 10:31
  • 2
    What gdalinfo tells about some problematic scan? Even better if you can provide a link to download one.
    – user30184
    Commented Feb 23, 2022 at 10:34
  • 2
    Welcome to GIS SE Kayleigh. It is always best to embed the image within the body of text rather than providing an external link.
    – Aaron
    Commented Feb 23, 2022 at 14:25
  • 1
    We need to see what the results are with screen shots please
    – Ian Turton
    Commented Feb 23, 2022 at 14:50
  • 4
    The size of the scanned image is 85 MB, providing the link is right thing to do.
    – user30184
    Commented Feb 23, 2022 at 16:41

2 Answers 2

7

Never seen this before but the scanned (or photographed?) image is marked as rotated into the EXIF metadata. The image looks like this with rotation-aware viewer (IrfanView):

enter image description here

but QGIS georeferencer, that is EXIF rotation unaware, opens it as it is physically stored into JPEG

enter image description here

Gdalinfo shows the EXIF metadata but only as information

gdalinfo Scan_20220125_203619.jpg
Driver: JPEG/JPEG JFIF
Files: Scan_20220125_203619.jpg
Size is 19872, 27992
Metadata:
  COMMENT=METADATA-
  EXIF_Orientation=6

EXIF orientation 6 means that image is rotated 90 degrees clockwise and photo viewers like IrfanView know to rotate it 90 degrees counterclockwise for showing https://www.impulseadventure.com/photo/exif-orientation.html.

I could fix the image for QGIS georeferencer by opening it with IrfanView and saving a copy. IrfanView reads the orientation tag when it opens the image and rotates it automatically. There is no need to rotate it another time. Just save, and the new copy will be also physically vertical and looks right in the QGIS georeferencer.

I did not check what orientation tag IrfanView writes. If it goes wrong then photo viewers may show the image rotated but that's another issue. IrfanView seems to have an option for controlling that tag so it should be possible to make both photo viewers and QGIS referencer to show the image in the same way.

1

If GDAL 3.7.0 (released June 2023) is installed, change the APPLY_ORIENTATION open option to YES, which can be done with the open dialog. Default NO behavior is to use the image with sensor orientation, ignoring EXIF_Orientation metadata.

Your Answer

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