Skip to content

Commit 6a32506

Browse files
committed
Fexing the problem of .ico size
1 parent fc06e8a commit 6a32506

6 files changed

Lines changed: 36 additions & 14 deletions

File tree

project_info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project>
33
<name>BulkFolder</name>
4-
<version>1.7.11</version>
4+
<version>1.7.12</version>
55
<description>The safest and fastest bulk organizer and renamer.</description>
66
<author>Achraf KHABAR / Open Source Community</author>
77
<repository>https://github.com/Ashraf-Khabar/bulkfolder</repository>

run_app.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ BASE_MODULE_RUN="bulkfolder.ui.main"
88
pip install -r requirements.txt
99

1010
cd ${BASE_PATH}
11-
python -m ${BASE_MODULE_RUN}
11+
python -m ${BASE_MODULE_RUN}

src/assets/logo.ico

22.1 KB
Binary file not shown.

src/assets/logo.png

130 KB
Loading

src/bulkfolder/ui/app.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,37 @@ def __init__(self):
179179
@staticmethod
180180
def _ensure_logo_exists(png_path: Path):
181181
ico_path = png_path.with_suffix(".ico")
182-
if png_path.exists() and ico_path.exists(): return
182+
183+
if not png_path.exists():
184+
return # Si tu n'as pas le PNG, on ne peut rien faire
185+
183186
try:
184-
img = Image.new("RGBA", (256, 256), (255, 255, 255, 0))
185-
draw = ImageDraw.Draw(img)
186-
draw.ellipse([(10, 10), (246, 246)], fill=(40, 42, 54, 255))
187-
png_path.parent.mkdir(parents=True, exist_ok=True)
188-
img.save(png_path, format="PNG")
189-
img.save(ico_path, format="ICO")
190-
except Exception: pass
187+
# 1. Ouvrir ton PNG original
188+
img = Image.open(png_path).convert("RGBA")
189+
190+
# 2. "Auto-crop" : On enlève tout le vide transparent autour du logo
191+
bbox = img.getbbox()
192+
if bbox:
193+
img = img.crop(bbox)
194+
195+
# 3. Créer un canvas carré de 256x256 (Taille max Windows)
196+
size = 256
197+
new_img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
198+
199+
# 4. Redimensionner ton logo pour qu'il touche presque les bords (98% de la taille)
200+
inner_size = int(size * 0.98)
201+
img.thumbnail((inner_size, inner_size), Image.Resampling.LANCZOS)
202+
203+
# Centrer le logo sur le canvas
204+
offset = ((size - img.size[0]) // 2, (size - img.size[1]) // 2)
205+
new_img.paste(img, offset, img)
206+
207+
# 5. Sauvegarder par-dessus ton .ico avec TOUTES les tailles Windows
208+
# C'est la couche (256, 256) qui rend l'icône "grande" sur le bureau
209+
new_img.save(ico_path, format="ICO", sizes=[(256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (16, 16)])
210+
211+
except Exception as e:
212+
print(f"Erreur lors de l'optimisation de l'icône : {e}")
191213

192214
def _show_main_window(self):
193215
try: self.splash.destroy()

version_info.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
55
VSVersionInfo(
66
ffi=FixedFileInfo(
7-
filevers=(1, 7, 11, 0),
8-
prodvers=(1, 7, 11, 0),
7+
filevers=(1, 7, 12, 0),
8+
prodvers=(1, 7, 12, 0),
99
mask=0x3f,
1010
flags=0x0,
1111
OS=0x40004,
@@ -20,12 +20,12 @@ VSVersionInfo(
2020
u'040904B0',
2121
[StringStruct(u'CompanyName', u'Zyloscore'),
2222
StringStruct(u'FileDescription', u'BulkFolder - Professional File Organizer'),
23-
StringStruct(u'FileVersion', u'1.7.11'),
23+
StringStruct(u'FileVersion', u'1.7.12'),
2424
StringStruct(u'InternalName', u'bulkfolder'),
2525
StringStruct(u'LegalCopyright', u'Copyright (c) 2024 Zyloscore'),
2626
StringStruct(u'OriginalFilename', u'BulkFolder.exe'),
2727
StringStruct(u'ProductName', u'BulkFolder'),
28-
StringStruct(u'ProductVersion', u'1.7.11')])
28+
StringStruct(u'ProductVersion', u'1.7.12')])
2929
]),
3030
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
3131
]

0 commit comments

Comments
 (0)