From 35b3b0097ff12a6ff7a98f001167fa16b497acd3 Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Sat, 6 Feb 2016 09:21:57 -0700 Subject: [PATCH] Fixed 256x256. --- pe.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pe.py b/pe.py index 9be861b..3e30222 100644 --- a/pe.py +++ b/pe.py @@ -1266,7 +1266,15 @@ class PEFile(Printable): g_entry = group_header.entries[0] icon = Image.open(icon_path) - i_data = resize(icon, (g_entry.Width.value, g_entry.Height.value), format='ico') + width = g_entry.Width.value + height = g_entry.Height.value + + if width == 0: + width = 256 + if height == 0: + height = 256 + + i_data = resize(icon, (width, height), format='ico') new_icon_size = len(i_data) icon_file_size = g_entry.DataSize.value+group_header.size+g_entry.size+2