1

In PSet 6 for CS50x Python, we are tasked with resizing a shirt to fit on the wearer. My code successfully changes the size of the shirt per the instructions, but the end result is slightly off from the demo visuals. It appears that, even though I've included wearer.size in the ImageOps.fit method, the shirt is still slightly stretched and pushed downwards:

        shirt = Image.open("shirt.png")
        wearer = Image.open(sys.argv[1])

        shirt = ImageOps.fit(shirt, wearer.size, method=Image.BICUBIC, bleed=0, centering=(0.5, 0.5))

        wearer.paste(shirt, shirt)
        wearer.save(sys.argv[2])

I am not 100% sure why this is the case. I am using the default parameters for ImageOps.fit, but could they be messing things up? Am I missing something obvious?

enter image description here

1 Answer 1

0

The problem states that "The program should then overlay shirt.png (which has a transparent background) on the input after resizing and cropping the input to be the same size, saving the result as its output."

You should be resizing the input image to fit into the shirt image, not the other way around

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .