Уведомления

Группа в Telegram: @pythonsu

#1 Июль 16, 2008 20:03:28

PantiL
От:
Зарегистрирован: 2008-05-21
Сообщения: 6
Репутация: +  0  -
Профиль   Отправить e-mail  

Наложение одного изображения на другое (PIL)

Подскажите как это реализуется.

Спасибо!



Офлайн

#2 Июль 16, 2008 20:25:34

Ferroman
От:
Зарегистрирован: 2006-11-16
Сообщения: 2759
Репутация: +  1  -
Профиль   Отправить e-mail  

Наложение одного изображения на другое (PIL)

В каком смысле “наложение”? Полное? Полупрозрачным?

Офлайн

#3 Июль 16, 2008 20:30:48

PantiL
От:
Зарегистрирован: 2008-05-21
Сообщения: 6
Репутация: +  0  -
Профиль   Отправить e-mail  

Наложение одного изображения на другое (PIL)

Картинка на которую будет делаться наложение в формате jpg - если возможно наложить полупрозрачное изображение, то необходим этот вариант, если нет, то пусть будет полное наложение



Офлайн

#4 Июль 16, 2008 21:21:23

Ferroman
От:
Зарегистрирован: 2006-11-16
Сообщения: 2759
Репутация: +  1  -
Профиль   Отправить e-mail  

Наложение одного изображения на другое (PIL)

Функции blend и composite - но надо привести оба изображения до одного размера.
Есть также Функции multiply, screen, blend, composite
Есть также метод paste:

paste
im.paste(image, box)

Pastes another image into this image. The box argument is either a 2-tuple giving the upper left corner, a 4-tuple defining the left, upper, right, and lower pixel coordinate, or None (same as (0, 0)). If a 4-tuple is given, the size of the pasted image must match the size of the region.
If the modes don't match, the pasted image is converted to the mode of this image (see the convert method for details).

im.paste(colour, box)

Same as above, but fills the region with a single colour. The colour is given as a single numerical value for single-band images, and a tuple for multi-band images.

im.paste(image, box, mask)

Same as above, but updates only the regions indicated by the mask. You can use either "1", "L" or "RGBA" images (in the latter case, the alpha band is used as mask). Where the mask is 255, the given image is copied as is. Where the mask is 0, the current value is preserved. Intermediate values can be used for transparency effects.
Note that if you paste an "RGBA" image, the alpha band is ignored. You can work around this by using the same image as both source image and mask.

im.paste(colour, box, mask)

Same as above, but fills the region indicated by the mask with a single colour.
Выбирайте.
Одним словом вопрос для темы “чтения манов вслух”.

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version