fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e5f7222
)
Necessary rounding.
author
Radek Czajka
<rczajka@rczajka.pl>
Fri, 29 Mar 2019 13:40:20 +0000
(14:40 +0100)
committer
Radek Czajka
<rczajka@rczajka.pl>
Fri, 29 Mar 2019 13:40:20 +0000
(14:40 +0100)
src/sponsors/models.py
patch
|
blob
|
history
diff --git
a/src/sponsors/models.py
b/src/sponsors/models.py
index
8b50552
..
dbc9b7a
100644
(file)
--- a/
src/sponsors/models.py
+++ b/
src/sponsors/models.py
@@
-66,14
+66,14
@@
class SponsorPage(models.Model):
if simg.size[0] > THUMB_WIDTH or simg.size[1] > THUMB_HEIGHT:
size = (
min(THUMB_WIDTH,
if simg.size[0] > THUMB_WIDTH or simg.size[1] > THUMB_HEIGHT:
size = (
min(THUMB_WIDTH,
-
simg.size[0] * THUMB_HEIGHT / simg.size[1]
),
+
round(simg.size[0] * THUMB_HEIGHT / simg.size[1])
),
min(THUMB_HEIGHT,
min(THUMB_HEIGHT,
-
simg.size[1] * THUMB_WIDTH / simg.size[0]
)
+
round(simg.size[1] * THUMB_WIDTH / simg.size[0])
)
)
simg = simg.resize(size, Image.ANTIALIAS)
sprite.paste(simg, (
)
simg = simg.resize(size, Image.ANTIALIAS)
sprite.paste(simg, (
-
(THUMB_WIDTH - simg.size[0]) / 2
,
-
i * THUMB_HEIGHT + (THUMB_HEIGHT - simg.size[1]) / 2
,
+
round((THUMB_WIDTH - simg.size[0]) / 2)
,
+
round(i * THUMB_HEIGHT + (THUMB_HEIGHT - simg.size[1]) / 2)
,
))
imgstr = BytesIO()
sprite.save(imgstr, 'png')
))
imgstr = BytesIO()
sprite.save(imgstr, 'png')