From ea23cb18acaa5fa2a7fde91975d51542f7fbb1bd Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 6 Aug 2011 14:14:22 +0000 Subject: [PATCH] changes to icon render script --- pandora/scripts/item_icon | 26 +++++++++++++++----------- static/png/icon.mask.png | Bin 3581 -> 2854 bytes 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pandora/scripts/item_icon b/pandora/scripts/item_icon index 49aaf7f..9fbc0f2 100755 --- a/pandora/scripts/item_icon +++ b/pandora/scripts/item_icon @@ -20,13 +20,13 @@ import sys static_root = os.path.join(os.path.dirname(__file__), '..', '..', 'static') def render_icon(frame, timeline, icon): - icon_width = 256 - icon_height = 256 - icon_image = Image.new('RGBA', (icon_width, icon_height)) + icon_width = 512 + icon_height = 512 + icon_image = Image.new('RGBA', (icon_width, icon_height), (0, 0, 0, 0)) frame_width = icon_width - frame_ratio = 4 / 3 + frame_ratio = 8 / 7 frame_height = int(round(frame_width / frame_ratio)) - frame_image = Image.open(frame) + frame_image = Image.open(frame) if frame else Image.new('RGB', (512, 448), (0, 0, 0)) frame_image_ratio = frame_image.size[0] / frame_image.size[1] if frame_ratio < frame_image_ratio: frame_image = frame_image.resize((int(frame_height * frame_image_ratio), frame_height), Image.ANTIALIAS) @@ -36,13 +36,17 @@ def render_icon(frame, timeline, icon): frame_image = frame_image.resize((frame_width, int(frame_width / frame_image_ratio)), Image.ANTIALIAS) top = int((frame_image.size[1] - frame_height) / 2) frame_image = frame_image.crop((0, top, frame_width, top + frame_height)) - icon_image.paste(frame_image, (0, 0)) - timeline_image = Image.open(timeline) - timeline_image = timeline_image.resize((icon_width, 64), Image.ANTIALIAS) - icon_image.paste(timeline_image, (0, icon_height - 64)) mask_image = Image.open(os.path.join(static_root, 'png', 'icon.mask.png')) - mask_image = mask_image.resize((icon_width, icon_height)) - icon_image.putalpha(mask_image) + icon_image.paste(frame_image, (0, 0), mask=mask_image) + timeline_image = Image.open(timeline) if timeline else Image.new('RGB', (512, 128), (0, 0, 0)) + timeline_image = timeline_image.resize((icon_width, 128), Image.ANTIALIAS) + timeline_mask_image = Image.new('L', (512, 128)) + timeline_mask_image.paste(mask.image.crop((0, 0, 511, 63)), (0, 0)) + timeline_mask_image.paste(mask.image.crop((0, 448, 511, 511)), (0, 64)) + icon_image.paste(timeline_image, (0, icon_height - 128), mask=timeline_mask_image) + #mask_image = Image.open(os.path.join(static_root, 'png', 'icon.mask.png')) + #mask_image = mask_image.resize((icon_width, icon_height)) + #icon_image.putalpha(mask_image) icon_image.save(icon) def main(): diff --git a/static/png/icon.mask.png b/static/png/icon.mask.png index f13365385e59262da27f23f98f2f135aa24d761e..d54625b6c34dcf0fda9fc5db7af676f843f2ae86 100644 GIT binary patch literal 2854 zcmeH}`8V5n7stOLGmIir)d{NA>X2ZlDx*{yip25^BGryHI<%cq(oI50lj_3QqBF4@ zAtqI7X-iRSs+LyOnxaKgqfMzLwopmN;U)lm3dbuhm+Cy^Amv=--!2iEfGMtU3S0ykC4;6 z3;Nke$KT^A&Pt(gEpyU=pngNug#ahgq&f72ke3*wdTAwc^w#5B2~hK7e~Yq@7~g<1 zfB&icV^6}rTzh2t!*`)1IMtSVbl!&Z3ACcN60FzkULtIW9(@=3Ht-ppla)3r!im%P zBjmLnZG82T3}$(z;TSP0pgC@4FpCh_AQN03Zz&t!GY&4YJD$K&r#!tmfnU1NW4+WM zVQRNZu&@o0S&{E2WEI*){milx&xkD|y(qw&C+O=G*NtRm4*VwsKMQU;ah(7t~Bb|D5U(p zz#I~yS@fthru;$5ZtkBF)3dGKymidFXp3hnvBI>HMZPN!lngJWEw76v63iH+jr)-D zxJYq(C5~Q9)0&rZk&vDXqd$kYjUZ_wgfSXt`gVunuMII&gJGoo5TB78c+!$?H3s)N zm!eS9OsRii;H+?;zbauSRp7Q7YFn;`wC}*E7Yc8~O`c*P{OAYNf2y&n!CS+r8GDNX zDd}&$$?>}i(bu{f+!#3e^FuUSS2ChG||O9B>p1sL(B4tT_=*eH2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