Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf33ffe5

Browse files
committed
feat(icon): add smoothing options for window icon fetching
1 parentd55af95 commitf33ffe5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/core/utils/win32/app_icons.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
frompathlibimportPath
1313
importwin32gui
1414
fromglobimportglob
15-
fromPILimportImage
15+
fromPILimportImage,ImageFilter
1616
fromsettingsimportDEBUG
1717

1818
pil_logger=logging.getLogger('PIL')
1919
pil_logger.setLevel(logging.INFO)
2020

2121
TARGETSIZE_REGEX=re.compile(r'targetsize-([0-9]+)')
2222

23-
defget_window_icon(hwnd,dpi=1.0):
23+
defget_window_icon(hwnd,smooth_level=0):
2424
"""Fetch the icon of the window."""
2525
try:
2626
hicon=win32gui.SendMessage(hwnd,win32con.WM_GETICON,win32con.ICON_BIG,0)
@@ -61,8 +61,12 @@ def get_window_icon(hwnd, dpi = 1.0):
6161
(bmpinfo['bmWidth'],bmpinfo['bmHeight']),
6262
raw_data,'raw','BGRA',0,1
6363
).convert('RGBA')
64-
target_size=48# target size (48x48) wihout DPI, most of uwps are also 44x44
65-
img=img.resize((target_size,target_size),Image.LANCZOS)
64+
#target_size = 48 # target size (48x48) wihout DPI, most of uwps are also 48x48
65+
#img = img.resize((target_size, target_size), Image.LANCZOS)
66+
ifsmooth_level==1:
67+
img=img.filter(ImageFilter.SMOOTH)
68+
elifsmooth_level==2:
69+
img=img.filter(ImageFilter.SMOOTH_MORE)
6670
returnimg
6771
finally:
6872
# Cleaning up resources

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp