Jump to content

Recommended Posts

Posted (edited)

 

cclogo.jpg

 

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:

ccluogo.jpg

 

Why not:
jpg.jpg

Edited by Trong

Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal

Posted

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!

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

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?

Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal

Posted

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.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

[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()

 

Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...