Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images stored upside down #3

Closed
letmaik opened this issue Oct 2, 2014 · 5 comments
Closed

Images stored upside down #3

letmaik opened this issue Oct 2, 2014 · 5 comments

Comments

@letmaik
Copy link

letmaik commented Oct 2, 2014

I find it extremely unintuitive that imageio (through freeimage) expects image arrays to be upside down to be saved correctly. Virtually every other library does it the other way. There should be a big fat warning in the imageio documentation that I have to flip my image. Ideally though, imageio would do the flipping for me (when reading or writing using freeimage). Or did I miss something fundamental? Btw, I'm writing 16bit tiff files.

Quoting freeimage docs:

In FreeImage, FIBITMAP are based on a coordinate system that is upside down
relative to usual graphics conventions. Thus, the scanlines are stored upside down,
with the first scan in memory being the bottommost scan in the image.

EDIT: Just noticed that I actually have to flip both axes, so img[::-1,::-1], really confusing.

EDIT2: Seems to be the same issue as in scikit-image/scikit-image#1101

@almarklein
Copy link
Member

I find it /extremely/ unintuitive that imageio (through freeimage)
expects image arrays to be upside down to be saved correctly. Virtually
every other library does it the other way. There should be a big fat
warning in the imageio documentation that I have to flip my image.
Ideally though, imageio would do the flipping for me (when reading or
writing using freeimage). Or did I miss something fundamental? Btw, I'm
writing 16bit tiff files.

AFAIK imageio saves the images in the same "orientation" as e.g.
matplotlib and Matlab do. What is your experience with these?

I was not aware that most other toolkits do it differently. If this is
the case, or if indeed its confusing, we should add this information to
the docs.

  • Almar

@letmaik
Copy link
Author

letmaik commented Oct 3, 2014

Please have a look at scikit-image/scikit-image#1101 I think this is the same issue and really a bug.

@almarklein
Copy link
Member

Ah, I did not understand that this was specific to 16bits images. I backported Stefan's Fix. Can you try and see whether it works?

@letmaik
Copy link
Author

letmaik commented Oct 7, 2014

Yep it's working.

@almarklein
Copy link
Member

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants