CyRius Posted April 26, 2009 Share Posted April 26, 2009 (edited) Hey. I want to save a part of an image to a file, which have alpha (transparent) background color, but when i save the file the alpha background becomes black colored. The icons size is decreased too from 30,7KB to 9,05KB, however the size didnt changed. "$GDIP_PXF32ARGB = 32 bits per pixel; 8 bits for each RGB and alpha component" So $GDIP_PXF32ARGB should create a 32 bit RGB and 8 bit alpha image, but it creates a 24 bit RGB and 1 bit alpha image. Can anyone tell me what is the problem with my source code or any idea how could i copy a part from the file in other way? Here it is my source: #include <GDIPlus.au3> $filePath = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt','InstallDir');checks the AutoIt's InstallDir FileCopy($filePath & '\Icons\au3.ico','au3.ico',1);copy an icon to @ScriptDir _GDIPlus_StartUp() $hImage = _GDIPlus_ImageLoadFromFile('au3.ico');load the image $CLSID = '{557CF400-1A04-11D3-9A73-0000F81EF32E}';GUID string of ICO encoder $hClone = _GDIPlus_BitmapCloneArea($hImage,0,0,48,48,$GDIP_PXF32ARGB);copy a 48x48 part from the file _GDIPlus_ImageSaveToFileEx($hClone,'NewIcon.ico',$CLSID);saves the file _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hClone) _GDIPlus_ShutDown()NewIcon.icoau3.ico Edited April 26, 2009 by CyRius [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
CyRius Posted April 26, 2009 Author Share Posted April 26, 2009 Bump# I cant believe it, that nobody can help me -.- [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
Developers Jos Posted April 26, 2009 Developers Share Posted April 26, 2009 Just be patient and don't bump a thread within 24 hours or else you find they will be closed. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UEZ Posted April 26, 2009 Share Posted April 26, 2009 (edited) Your code is creating a BMP and not an ico file and BMP cannot save alpha channel as fas as I know! I don't know yet whether _GDIPlus_ImageSaveToFileEx() can create ico files! You can use e.g. $sCLSID = _GDIPlus_EncodersGetCLSID ("JPG") function to set correct CLSID. UEZ Edited April 26, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CyRius Posted April 26, 2009 Author Share Posted April 26, 2009 @UEZ Thank you. As i know JPG cannot have alpha layer, or any transparent layer. But i will try it. Greetz, CyRius [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
UEZ Posted April 26, 2009 Share Posted April 26, 2009 This was just an example about the output format, not for transparency. You can use $sCLSID = _GDIPlus_EncodersGetCLSID ("PNG") for transparency. UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CyRius Posted April 26, 2009 Author Share Posted April 26, 2009 @UEZ I didnt find any UDFs, how could i add a PNG image to a GuiCtrlCreatePic() control So i cant use the PNG format. [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
UEZ Posted April 26, 2009 Share Posted April 26, 2009 @UEZI didnt find any UDFs, how could i add a PNG image to a GuiCtrlCreatePic() control So i cant use the PNG format.There is a nice example in AutoIt Help -> look for GuiCtrlCreatePic() UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CyRius Posted April 26, 2009 Author Share Posted April 26, 2009 Thanks UEZ, i found it, i was just "noob" ) Greetz, CyRius:) [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
CyRius Posted April 27, 2009 Author Share Posted April 27, 2009 Ohm:) I'm here again, because i have a new question. I made this function to create the image array and the MY_WM_PAINT() draws the images from this array. ($sGraphic is global variable). Is there any way to get the PNG image's handle, so i can use image like a button (like GuiCtrlCreatePic() or GuiCtrlCreateIcon() )? Func GuiCtrlCreatePNGImage($hGUI,$hFile,$hXpos,$hYPos) If $hGUI = $hGUIlast Then $sGraphic[0][0] += 1 Else $sGraphic[0][0] = 1 $hGUIlast = $hGUI EndIf $sGraphic[$sGraphic[0][0]][0] = $hGUI $sGraphic[$sGraphic[0][0]][1] = _GDIPlus_ImageLoadFromFile($hFile) $hControlHwnd = $sGraphic[$sGraphic[0][0]][2] = _GDIPlus_GraphicsCreateFromHWND($hGUI) $sGraphic[$sGraphic[0][0]][3] = $hXpos $sGraphic[$sGraphic[0][0]][4] = $hYPos Return $hControlHwnd EndFunc Greetz, CyRius [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now