Giter Club home page Giter Club logo

Comments (7)

mdboom avatar mdboom commented on May 18, 2024

JPG loading is handled through PIL, and the pil_to_array code explicitly flips the image upside down. This seems like a bug, but I'm hesitant to fix it since it's been that way for at least 3 years in a commit by @jdh2358 -- I'm surprised we're just finding it now -- and this isn't an area I'm terribly familiar with.

diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py
index f2d9984..93402d4 100644
--- a/lib/matplotlib/image.py
+++ b/lib/matplotlib/image.py
@@ -1257,7 +1257,7 @@ def pil_to_array( pilImage ):
     """
     def toarray(im):
         'return a 1D array of floats'
-        x_str = im.tostring('raw',im.mode,0,-1)
+        x_str = im.tostring()
         x = np.fromstring(x_str,np.uint8)
         return x
 

from matplotlib.

leejjoon avatar leejjoon commented on May 18, 2024

I think the thread below is related with this issue. I don't think we actually made any action though.

http://old.nabble.com/Question-about-imshow-ts23578564.html

from matplotlib.

mdboom avatar mdboom commented on May 18, 2024

Changing assignment to Andrew, since I don't quite understand the history and backward incompatibility issues.

from matplotlib.

stefanv avatar stefanv commented on May 18, 2024

I can verify that this is a bug. Here's the much simplified version we use in scikits.image:

https://github.com/scikits-image/scikits.image/blob/master/scikits/image/io/_plugins/pil_plugin.py#L12

from matplotlib.

mdboom avatar mdboom commented on May 18, 2024

I believe this is fixed by #616.

from matplotlib.

pelson avatar pelson commented on May 18, 2024

I can confirm that this was fixed 5 days ago.

from matplotlib.

mdboom avatar mdboom commented on May 18, 2024

Just a note: as this is a pretty significant backward-incompatible change, it is only on master, and won't be in the 1.1.2rc.

from matplotlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.