rapot Posted January 17, 2012 Share Posted January 17, 2012 I want to load an image file, edit..., then... save it. Load image : #include <gdip.au3> #include <GDIPlus.au3> $image = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg") Edit : put pixel _GDIPlus_BitmapSetPixel($image, 15, 10, 0xffff00ff) Save : _GDIPlus_ImageSaveToFile($image, @MyDocumentsDir & "\GDIPlus_Image.jpg") so it don't work. Please help me. Link to comment Share on other sites More sharing options...
UEZ Posted January 17, 2012 Share Posted January 17, 2012 Try this here: #include <GDIPlus.au3> _GDIPlus_Startup() Global Const $sFile = StringReplace(@AutoItExe, "autoit3.exe", "ExamplesGUITorus.png") Global Const $hBrush = _GDIPlus_BrushCreateSolid(0x80FFFF00) Global Const $hBitmap = _GDIPlus_BitmapCreateFromFile($sFile) Global Const $iW = _GDIPlus_ImageGetWidth($hBitmap ) Global Const $iH = _GDIPlus_ImageGetHeight($hBitmap ) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillRect($hContext, $iW / 3, $iH / 3, $iW / 3, $iH / 3, $hBrush) _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "Test.jpg") _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BrushDispose($hBrush) _GDIPlus_Shutdown() ShellExecute(@ScriptDir & "Test.jpg") Br, 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...
rapot Posted January 18, 2012 Author Share Posted January 18, 2012 still save as different file. I want save : _GDIPlus_ImageSaveToFile($hBitmap, $sFile) overwrite not work? Link to comment Share on other sites More sharing options...
UEZ Posted January 18, 2012 Share Posted January 18, 2012 (edited) The file is locked by GDI+. Just save it with a different name and when file has been unlocked delete original file and rename new file back to original filename. Br, UEZ Edited January 18, 2012 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...
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