A
A
anokhovd2018-08-02 20:47:56
Python
anokhovd, 2018-08-02 20:47:56

How to insert an image with a transparent background on top of another in PIL?

I need to insert an image with a transparent background on another
I used:
img.paste(img2,box,mask = img2)
But if the image is white then an error is thrown:

Traceback (most recent call last):
  File "C:/Users/Даниил/PycharmProjects/discordbot/test.py", line 32, in <module>
    img.paste(item, (3, 3), mask=item)
  File "C:\Users\Даниил\AppData\Local\Programs\Python\Python36\lib\site-packages\PIL\Image.py", line 1421, in paste
    self.im.paste(im, box, mask.im)
ValueError: bad transparency mask

What do you advise?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2015-01-07
@IceJOKER

You need nodejs , and then the commands are written there.
npm install peer - install peer package
peerjs --port 9000 --key peerjs - and this command, as I understand it, starts the server and port 9000

E
Ewboa, 2015-01-07
@Ewboa

how to install node.js on hosting?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question