Home / GitHub Page

Photo rotation

#1

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?

#2

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

#3

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?

#4

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.

#5

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.

#6

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?

#7

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…

#8

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

#9

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…

#10

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.

#11

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

#12

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.

#13

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?

#14

The orginal one :thinking:

#15

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.