Below I have some code that gets a .exe file and get the image from it and saves it as a .bmp file. Which is great but I need to saave the .bmp witht he original transparent background that the .exe file icon had. Is there a way to modify the code below to do that?
Code:
def image2(path):
path = path.replace("\\", "/")
icoX = win32api.GetSystemMetrics(win32con.SM_CXICON)
icoY = win32api.GetSystemMetrics(win32con.SM_CXICON)
large, small = win32gui.ExtractIconEx(path, 0)
win32gui.DestroyIcon(small[0])
hdc = win32ui.CreateDCFromHandle(win32gui.GetDC(0))
hbmp = win32ui.CreateBitmap()
hbmp.CreateCompatibleBitmap(hdc, icoX, icoX)
hdc = hdc.CreateCompatibleDC()
hdc.SelectObject(hbmp)
hdc.DrawIcon((0,0), large[0])
savePath = "Octo Organizer (Hybrid Edition)/Files/"
#hbmp.SaveBitmapFile(hdc, savePath + "None.bmp")
bmpinfo = dataBitMap.GetInfo()
image2("C/Users/None/Desktop/Mozilla.exe") #This is just a example file path.