Home / GitHub Page

Photo rotation


Hi again,

I have an issue with photos, that I took with my camera/smartphone. Whenever photo was taken vertically and I want to attach it in a note it changes its orientation to horizontal, even though in folder view it is shown vertically. It may sound like not a big deal, but some of my notes contain photos of my handwriten notes and it is hard to read them that way :confused: if i remember correctly I had the same issue with other markdown editors, so I believe it’s not Joplin’s fault, but maybe somebody here has an idea how can I fix it?


Ok, so here is what I meant: https://imgur.com/a/PdxVnFu
Any ideas what can I do to prevent it?


It seems the app doesn’t respect the image rotation flag. Any chance you could add an issue on GitHub to keep track of this?


I just tried to reproduce the issue, but couldn’t. I took one picture vertically (as the OP), attached it and it shows correctly. Then I took another one horizontally, and yet again, it shows correctly in Joplin.

Maybe it is a combination of several factors. e.g. camera that took the pic, client OS, …

I’ve been testing on git master on macOS 10.14.4 and I used a Google Pixel to take the picture.


Some cameras encode rotation in an image differently, the JPEG format allows for a horizontal flag instead of actually rotating an image. It appears thay Joplin is ignoring this flag. I’m not sure how easy the fix will be.


Is there anything that I can somehow change or do with the JPEG to make it shows a pic correctly in Joplin? If it’s not a common issue I doubt there is a need for a change in Joplin. I took pics with my camera and my samsung galaxy, in both cases the same issue. Might it be my Windows 8 the problem?


Not really sure what the problem is right now, but this should be fixed nonetheless. I just hope there is a fix for it. I assume there’s a module responsible for reading exif data. Can you post your image here (the one in the link you sent)? I can try attaching it to a note on my system. I’m curious what happens.

Btw, here’s the pic I took. Just in case, you want to try it on your system…


It looks like there’s no fix for this unfortunately as it’s a bug (or unsupported feature) in Chrome: https://github.com/electron/electron/issues/8059


Yea, this is a weird one. A few years later and there’s still no fix. While going through the Chromium bug, I came across the following, which is apparantly used as a workaround: https://github.com/edemaine/coauthor/blob/99169115fc7ed37cd3d0fc9ec5de4f2d9e7151e1/client/messageImage.coffee

It’s coffeescript, so there should be a way to get the corresponding js. We could create a workaround function, which is used as long as Chromium hasn’t been fixed…


I don’t quite understand this code but I see calls to “Meteor”, which might mean it’s using server-side stuff to fix the image? On Joplin, we could also read the Exif rotation tag and rotate the image base on it I guess.


Here is my pic: https://imgur.com/a/jUj2xzk

I’ve made some testing. Apparently if I open the pic on macOS, rotate it there (I know it sounds silly) then copy it back to PC with Windows it shows corectly :slight_smile: I don’t really know what it means exactly, but I guess it’s something with Windows


I don’t know coffee script. Even javascript is still a mystery to me. :wink: I just thought it could help. If not, maybe rotating based on the exif tag should do the trick.


I just downloaded your pic and attached it in Joplin. It shows correctly. Is that the one you have already changed on macOS or the original one?


The orginal one :thinking:


On this repo, there are a few images to test with: https://github.com/recurser/exif-orientation-examples

Most of them won’t display correctly in Joplin.