I have some images on my Windows system and I was going to use them as Page Resources. The image was portrait but I wanted it landscape so I doubled clicked on the image, it opened up in Windows Photos preview/viewer app. At the top, there is a little Rotation icon to rotate the image. I clicked on it. In File Explorer it now shows as landscape. Even if I open it in Irfranviewer it shows as landscape. But when I load it in the page with Hugo Page Resources, even doing resizing and format conversion, it is the original orientation. I checked right after loading the resource and had it print out on the page the dimensions. As far as Hugo was concerned, it was a portrait image. I had to open it up in another program, save it as landscape, and then Hugo correctly saw it as landscape.
Not sure what’s going on, or what is even the source of the issue, but it was unexpected! Any ideas?
Try removing EXIF data from the photo and try again. It’s not Hugo that is doing that but rather a browser.
It’s definitely not the browser doing that because I load and display the dimensions in Hugo first before any processing or html happens. The width and height say it is portrait until I saved it with another application.
I’m wondering if anyone else can replicate this.
Where it’s hosted.
is there any post image processing happening after deployment. For example Netlify got Image Optimisation.
Could you send a link to picture and to page where it’s used and showed incorrectly.
It’s all local. Just noticed it running Hugo server. After the image was resaved using a different program, Hugo reported the width and the height also changed as expected. So I know it’s not an issue with the server or the browser. It may not be an issue with Hugo either, it’s probably an issues with Photos. But Hugo seems to pick up on something in the file that Photos doesn’t do a good or complete job of writing to, that other programs don’t pick up on.
Anyway, best advice is just don’t use Windows Photos preview to rotate images.
Hugo currently does not respect the EXIF rotate info, which is unfortunate, but there is an open issue about it. This is probably what you see. We will fix that … but until then, there is a workaround floating around, but I would suggest you just somehow save your image with the correct rotation (which may be easier said than done).
I appreciate the insight, and this is a very low impact “issue” for me at least in the sense that it is indeed very easy to use a different (and better) program to rotate images. I just thought it was strange but I learned something, that the EXIF contains rotation and that’s all it’s changing, not the actual image. So thank you!
Yes, it’s most likely Windows Photo viewer issue and the fact that rotation is not saved in file.
To check that, do Md5 checksum of image prior to rotation and recheck after rotation.
Think that this app is saving this locally only.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.