Skip to content

Cropping coordinate specification issue #681

@kevinw26

Description

@kevinw26

When specifying where to crop, wand crops at the wrong place. This is the code I am using to produce the following images.

from wand.color import Color
from wand.display import display
from wand.drawing import Drawing
from wand.image import Image

i = Image(filename=r'../../data/wtf.png')
with Drawing() as draw:
    draw.stroke_width = 2
    draw.stroke_color = Color('red')
    draw.line((158, 0), (150, i.height))
    draw(i)

display(i)

i.crop(left=158)
display(i)

This is the source image that I am trying to crop.

Image

The 158th pixel that I am trying to crop at can be drawn correctly and is located left of the C in Carthage.

Image

But when I try to crop it with i.crop(left=158) it doesn't crop there, instead cropping around 195.

Image

This doesn't seem to recur with some other images. I'm not sure why this one specifically is causing problems.

This problem does not happen if I convert the image into PIL, crop it, and then convert it back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions