redfenix Posted July 18, 2013 Posted July 18, 2013 Hello, how can i do for draw png image over jpg image? (i know gdiplus) Thanks!
Artisan Posted July 18, 2013 Posted July 18, 2013 Check out the helpfile for GUICtrlCreatePic(). No, it can't be used directly to display a .png, but it *does* show you an example of GDI+ being used to show a .png image. Once you've got that, you just need to display your .jpg image via GDI+ or GUICtrlCreatePic().
redfenix Posted July 18, 2013 Author Posted July 18, 2013 So i load png image first, then jpg? my idea: this and this become this. In your method i haven't this result
Solution Loken Posted July 19, 2013 Solution Posted July 19, 2013 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <GuiConstantsEx.au3> Local $Form1_1,$Pic1,$hImage,$hGraphic Opt("MustDeclareVars", 1) #Region ### START Koda GUI section ### Form=c:\users\bt\desktop\autoit\png over jpg\form1.kxf $Form1_1 = GUICreate("Form1", 152, 151, 192, 124) $Pic1 = GUICtrlCreatePic("C:\Users\BT\Desktop\Autoit\PNG over JPG\image2.jpg", 0, 0, 150, 150) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GDIPlus_StartUp() $hImage = _GDIPlus_ImageLoadFromFile("image1.png") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1_1) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage,-10, 0) do until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown() You may continue resting
UEZ Posted July 19, 2013 Posted July 19, 2013 (edited) Hello, how can i do for draw png image over jpg image? (i know gdiplus) Thanks! If you know GDI+ where is your try? Anyhow, here a way to do it: #include <GDIPlus.au3> _GDIPlus_Startup() $hBmp_Background = _GDIPlus_BitmapCreateFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg") ;load background image $hGfxContext = _GDIPlus_ImageGetGraphicsContext($hBmp_Background) ;get graphic context $hBmp_Foreground = _GDIPlus_BitmapCreateFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png") ;load a transparent png image _GDIPlus_GraphicsDrawImageRect($hGfxContext, $hBmp_Foreground, _ _GDIPlus_ImageGetWidth($hBmp_Background) - _GDIPlus_ImageGetWidth($hBmp_Foreground), _ ;position right upper corner 0, _ _GDIPlus_ImageGetWidth($hBmp_Foreground), _ ;get width from foreground image _GDIPlus_ImageGetHeight($hBmp_Foreground)) ;;get height from foreground image $sFile = @ScriptDir & "\New_Image.png" _GDIPlus_ImageSaveToFile($hBmp_Background, $sFile) _GDIPlus_GraphicsDispose($hGfxContext) _GDIPlus_BitmapDispose($hBmp_Background) _GDIPlus_BitmapDispose($hBmp_Foreground) _GDIPlus_Shutdown() ShellExecute($sFile) Exit Both images from your link in post #3 are JPGs. Br, UEZ Edited July 19, 2013 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
redfenix Posted July 20, 2013 Author Posted July 20, 2013 (edited) Ohh *.* Thanks a lot! EDIT: tinypic convert png to jpg Edited July 20, 2013 by redfenix
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