Trong Posted November 16, 2015 Share Posted November 16, 2015 (edited) Local $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\IMGtran.png") Local $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") _GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir&"\imgOut.jpg", $sCLSID) Local $sCLSID = _GDIPlus_EncodersGetCLSID("GIF") _GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir&"\imgOut.gif", $sCLSID) Local $sCLSID = _GDIPlus_EncodersGetCLSID("BMP") _GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir&"\imgOut.bmp", $sCLSID) Image ouput: Why not: Edited November 16, 2015 by Trong Regards, Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2015 Share Posted November 16, 2015 Try this:#include <GDIPlus.au3> _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromMemory(InetRead("http://lifestyle.classifiedads4free.com/wp-content/uploads/2014/06/clash-of-clans-logo-672x321.png", 8)) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hImage_new = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage_new) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $iW, $iH) _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x321.jpg") _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x321.gif") _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x321.bmp") _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_new) _GDIPlus_Shutdown()I cannot tell you why this effect appears when the image is directly saved! Trong 1 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...
Trong Posted November 16, 2015 Author Share Posted November 16, 2015 Try this:#include <GDIPlus.au3> _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromMemory(InetRead("http://lifestyle.classifiedads4free.com/wp-content/uploads/2014/06/clash-of-clans-logo-672x321.png", 8)) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hImage_new = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage_new) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $iW, $iH) _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x321.jpg") _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x321.gif") _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x321.bmp") _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_new) _GDIPlus_Shutdown()I cannot tell you why this effect appears when the image is directly saved! seemed better, but the image quality is not the best? Regards, Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2015 Share Posted November 16, 2015 For BMP it should be the same as the PNG but without transparency.For GIF it is dithered because of 8-bit (max. 256 color).For JPG you can set the quality but not with that code. Trong 1 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...
Trong Posted November 16, 2015 Author Share Posted November 16, 2015 [SOLVED]$hImage_new = _GDIPlus_BitmapCreateFromScan0($iW, $iH,$GDIP_PXF32RGB) #include <GDIPlus.au3> _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromMemory(InetRead("http://lifestyle.classifiedads4free.com/wp-content/uploads/2014/06/clash-of-clans-logo-672x321.png", 8)) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hImage_new = _GDIPlus_BitmapCreateFromScan0($iW, $iH,$GDIP_PXF32RGB) $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage_new) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $iW, $iH) _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x3211.jpg") _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x3211.gif") _GDIPlus_ImageSaveToFile($hImage_new, @ScriptDir & "\clash-of-clans-logo-672x3211.bmp") _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_new) _GDIPlus_Shutdown() Regards, Link to comment Share on other sites More sharing options...
UEZ Posted November 16, 2015 Share Posted November 16, 2015 Good catch Trong! Trong 1 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