From 154ed0c4f9fa6032bfda7977b3fbb8230c3a1720 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Wed, 20 Feb 2019 19:25:39 +0100 Subject: [PATCH] Make padding better, depending on the size; Fixes #48 --- ivatar/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ivatar/views.py b/ivatar/views.py index 300d267..db0be2d 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -157,6 +157,10 @@ class AvatarImageView(TemplateView): 'rgb(141,69,170)'] background = 'rgb(224,224,224)' padwidth = int(size/10) + if padwidth < 10: + padwidth = 10 + if size < 60: + padwidth = 0 padding = (padwidth, padwidth, padwidth, padwidth) # Since padding is _added_ around the generated image, we # need to reduce the image size by padding*2 (left/right, top/bottom)