Achilles Posted January 3, 2010 Posted January 3, 2010 I want to resize an image that is say 1600x1200 to say 400x300. Is this possible with only GDIPlus functions? I've looked at some of the functions but don't see how I could make it work. Any ideas? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
ChrisL Posted January 3, 2010 Posted January 3, 2010 Its been done loads, use the forum search and you will find them [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
UEZ Posted January 3, 2010 Posted January 3, 2010 I want to resize an image that is say 1600x1200 to say 400x300. Is this possible with only GDIPlus functions? I've looked at some of the functions but don't see how I could make it work. Any ideas? Here a very simple GDI+ example: #include <GDIplus.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) Global $file, $msg Do $file = FileOpenDialog("Select Image to load", @ScriptDir, "Images (*.jpg;*.png; *.bmp;*.gif)") If @error Then $msg = MsgBox(20, "Error", "Please select an image!") If $msg = 7 Then Exit Else SetError(1) EndIf EndIf Until Not @error _GDIPlus_Startup() Global $hImage = _GDIPlus_BitmapCreateFromFile($file) Global $iX = _GDIPlus_ImageGetWidth($hImage) Global $iY = _GDIPlus_ImageGetHeight($hImage) Global $resize_factor = 0.5 Global $hwnd = GUICreate("GDI+: Image resized to " & $iX * $resize_factor & "x" & $iY * $resize_factor, $iX * $resize_factor, $iY * $resize_factor, -1, -1) GUISetState(@SW_SHOW) Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX * $resize_factor, $iY * $resize_factor) While Sleep(30) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Exit EndSwitch WEnd I hope it helps! 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Achilles Posted January 4, 2010 Author Posted January 4, 2010 I should have searched before I posted... Sometimes I just get random ideas and forget to wonder if other people have tried them before. Anyway, thanks UEZ that was just what I was looking for. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
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