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

Image as numpy array fails when height != width #447

Closed
JaviFuentes94 opened this issue Dec 26, 2019 · 2 comments
Closed

Image as numpy array fails when height != width #447

JaviFuentes94 opened this issue Dec 26, 2019 · 2 comments
Labels
Milestone

Comments

@JaviFuentes94
Copy link

@JaviFuentes94 JaviFuentes94 commented Dec 26, 2019

with Drawing() as draw:
         draw.stroke_color = Color('black')
            draw.stroke_width = 2
            draw.line((50, 50),  (40, 20)) 
            with Image(width=150, height=100, background=Color('lightblue')) as image:
                draw(image)
                 image_arr = np.array(image)
                assert (image.height, image.width) == image_arr.shape[:2] 

This small snippet fails as the width and height are different. If we set them to be the same there are no issues, and the image_arr looks like it should.

@emcconville
Copy link
Owner

@emcconville emcconville commented Dec 26, 2019

Wand orders shape data as (WIDTH, HEIGHT, CHANNELS). Try

assert (image.width, image.height) == image_arr.shape[:2]

emcconville added a commit that referenced this issue Dec 27, 2019
@emcconville emcconville added this to the Wand 0.6.0 milestone Dec 27, 2019
@emcconville
Copy link
Owner

@emcconville emcconville commented Dec 27, 2019

Shape attribute order should be updated with correct values. Attaching to 0.6 release milestone.

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

No branches or pull requests

2 participants