Derotating image with EXIF orientation
If you want to overlay a rendered graphics on top of an image or a static video in Blender you should use the fSpy tool. It matches the camera to specified frame of reference. Unfortunately it doesn’t support EXIF meta information. That means that it sometimes fails to properly orient an image.
When it comes to an image orientation there are two factors: how image is encoded and the EXIF orientation value. A great explanation can be found here.
In order for the
fSpy
to not get confused you should first reset the
EXIF
orientation
flag. You can use a
Linux
tool called
exiftool
(if you are using
Windows
you can use
the
Windows Subsystem for Linux).
exiftool -Orientation=1 -n image.jpg
Most likely now, any image browser will show you the image incorrectly rotated. That’s because now the image browser shows how the image is encoded in memory. The EXIF information stops being a factor.
Now, in order to fix the image, you should rotate it in your image browser (i.e. IrfanView, XnView). You can also use a command line tool like:
jpegtran -rotate 90 -trim image.jpg rotated_image.jpg
Image modified like this should work well in fSpy.