D
D
Dmitry2017-02-12 16:53:16
PHP
Dmitry, 2017-02-12 16:53:16

How to make a round avatar from a rectangular photo?

The whole task is in the question and tags, I myself tend to the method with face recognition in the photo, but can there be something simpler?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dimonchik, 2017-02-12
@topwebmaster

www.pyimagesearch.com/2015/05/11/creating-a-face-d...
only a photo studio is easier

D
Dark Hole, 2017-02-12
@abyrkov

.img {
  border-radius: 1000px;
}

1
1011, 2017-02-12
@1011

maybe so

from PIL import Image
im = Image.open("путь")
mask = Image.open("путь")

#подгоняем под размеры маски, сделано без сохранения пропорций
w_img, h_img = mask.size
im = im.resize((w_img, h_img), Image.ANTIALIAS)

#накладываем маску поверх
im.paste(mask, (0, 0))
im.save("путь", quality=90)

W
WarriorKodeK, 2017-02-12
@WarriorKodeK

.foto {
border-radius: 100px; /* Rounding radius */
border: 3px solid black; /* Frame options */
background-size: cover; /*Scales photo*/
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question