Jump to content

Recommended Posts

Posted

Hello everyone,

Maybe the question is a little silly, but I do not know much about programming...

So could someone help me in code below?

How to add the following parameters: Quality together with other(s) parameter(s)?

Example:

$tData = DllStructCreate("int Quality")
DllStructSetData($tData, "Quality", 70)
_GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, DllStructGetPtr($tData))

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hBitmap, $hImage, $sCLSID, $tData, $tParams

    ; Capture screen
    _ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; Initialize GDI+ library
    _GDIPlus_Startup ()

    ; Load image
    $hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; Get JPEG encoder CLSID
    $sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

    ; Set up parameters for 90 degree rotation
    $tData = DllStructCreate("int Data")
    DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
    $tParams = _GDIPlus_ParamInit (1)
    _GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))

    ; Save image with rotation
    _GDIPlus_ImageSaveToFileEx ($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg", $sCLSID, DllStructGetPtr($tParams))

    ; Shut down GDI+ library
    _GDIPlus_ShutDown ()

EndFunc   ;==>_Main

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Posted

I think is the same for more parameters [not tested]

$tData = DllStructCreate("int Rotate; int Quality")
DllStructSetData($tData, "Rotate", $GDIP_EVTTRANSFORMROTATE90)
DllStructSetData($tData, "Quality", 10)
$tParams = _GDIPlus_ParamInit (2)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Rotate"))
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGQUALITY, 2, $GDIP_EPTLONG, DllStructGetPtr($tData, "Quality"))
Posted

I think is the same for more parameters [not tested]

$tData = DllStructCreate("int Rotate; int Quality")
DllStructSetData($tData, "Rotate", $GDIP_EVTTRANSFORMROTATE90)
DllStructSetData($tData, "Quality", 10)
$tParams = _GDIPlus_ParamInit (2)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Rotate"))
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGQUALITY, 2, $GDIP_EPTLONG, DllStructGetPtr($tData, "Quality"))

I had tried this before, not working...

And this line:

_GDIPlus_ParamAdd ($tParams, $GDIP_EPGQUALITY, 2, $GDIP_EPTLONG, DllStructGetPtr($tData, "Quality"))[/code]
should be this:
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Quality"))[/code]

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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...