|
12 | 12 | frompathlibimportPath
|
13 | 13 | importwin32gui
|
14 | 14 | fromglobimportglob
|
15 |
| -fromPILimportImage |
| 15 | +fromPILimportImage,ImageFilter |
16 | 16 | fromsettingsimportDEBUG
|
17 | 17 |
|
18 | 18 | pil_logger=logging.getLogger('PIL')
|
19 | 19 | pil_logger.setLevel(logging.INFO)
|
20 | 20 |
|
21 | 21 | TARGETSIZE_REGEX=re.compile(r'targetsize-([0-9]+)')
|
22 | 22 |
|
23 |
| -defget_window_icon(hwnd,dpi=1.0): |
| 23 | +defget_window_icon(hwnd,smooth_level=0): |
24 | 24 | """Fetch the icon of the window."""
|
25 | 25 | try:
|
26 | 26 | hicon=win32gui.SendMessage(hwnd,win32con.WM_GETICON,win32con.ICON_BIG,0)
|
@@ -61,8 +61,12 @@ def get_window_icon(hwnd, dpi = 1.0):
|
61 | 61 | (bmpinfo['bmWidth'],bmpinfo['bmHeight']),
|
62 | 62 | raw_data,'raw','BGRA',0,1
|
63 | 63 | ).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) |
66 | 70 | returnimg
|
67 | 71 | finally:
|
68 | 72 | # Cleaning up resources
|
|