1 year ago

#371999

test-img

lecogiteur

background color of JPG using wand (Python)

I use wand with Python to change the background color of a JPEG.

with Image(file=myJpg) as image:
    image.background_color = Color("#f0f0f0")
    image.save(filename='myJpg.jpg')

It seems to work because when I resize and extent image the background is filled with "#f0f0f0" (rgb(240,240,240)).

The image is a JPEG.

If I reload the image and get the background, it is white rgb(255,255,255):

with Image(file=myJpg) as img:
    assert img.background_color == Color("#f0f0f0")

The assertion is false. I don't understand why?

python

imagemagick

wand

0 Answers

Your Answer

Accepted video resources