Jump to content

operation on images


Recommended Posts

hello to all,

is possible to open given image, rotate 180, and flip orizzontally, using only Autoit ?

thank you for any info,

m.

http://msdn.microsoft.com/en-us/library/ms534041%28VS.85%29.aspx

http://msdn.microsoft.com/en-us/library/ms535401%28VS.85%29.aspx

#include <GDIPlus.au3>


Global enum _
    $RotateNoneFlipNone = 0 , _
    $Rotate90FlipNone = 1 , _
    $Rotate180FlipNone = 2 , _
    $Rotate270FlipNone = 3 , _
    $RotateNoneFlipX = 4 , _
    $Rotate90FlipX = 5 , _
    $Rotate180FlipX = 6 , _
    $Rotate270FlipX = 7 , _
    $RotateNoneFlipY = 6 , _
    $Rotate90FlipY = 7 , _
    $Rotate180FlipY = 4 , _
    $Rotate270FlipY = 5 , _
    $RotateNoneFlipXY = 6 , _
    $Rotate90FlipXY = 7 , _
    $Rotate180FlipXY = 0 , _
    $Rotate270FlipXY = 1



_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")
DllCall($ghGDIPDll,"int","GdipImageRotateFlip","hwnd",$hImage,"long",$Rotate90FlipNone)
 _GDIPlus_ImageSaveToFile ($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")
_WinAPI_DeleteObject ($hImage)
_GDIPlus_ShutDown ()

صرح السماء كان هنا

 

Link to comment
Share on other sites

http://msdn.microsoft.com/en-us/library/ms534041%28VS.85%29.aspx

http://msdn.microsoft.com/en-us/library/ms535401%28VS.85%29.aspx

#include <GDIPlus.au3>


Global enum _
    $RotateNoneFlipNone = 0 , _
    $Rotate90FlipNone = 1 , _
    $Rotate180FlipNone = 2 , _
    $Rotate270FlipNone = 3 , _
    $RotateNoneFlipX = 4 , _
    $Rotate90FlipX = 5 , _
    $Rotate180FlipX = 6 , _
    $Rotate270FlipX = 7 , _
    $RotateNoneFlipY = 6 , _
    $Rotate90FlipY = 7 , _
    $Rotate180FlipY = 4 , _
    $Rotate270FlipY = 5 , _
    $RotateNoneFlipXY = 6 , _
    $Rotate90FlipXY = 7 , _
    $Rotate180FlipXY = 0 , _
    $Rotate270FlipXY = 1



_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")
DllCall($ghGDIPDll,"int","GdipImageRotateFlip","hwnd",$hImage,"long",$Rotate90FlipNone)
 _GDIPlus_ImageSaveToFile ($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")
_WinAPI_DeleteObject ($hImage)
_GDIPlus_ShutDown ()

Hi

Nice example >_<

I'd always flipped an image by initiating a param and passing the param to _GDIPlus_ImageSaveToFileEx() as in the Help file shows under the _GDIPlus_ParamInit() example.

But I like your method better as it's easier to follow... good job , neato :(

You should write that "GdipImageRotateFlip" into function format and submit it for GDIPlus.au3 UDF

Cheers

Edited by smashly
Link to comment
Share on other sites

Link to comment
Share on other sites

Hi

Nice example >_<

I'd always flipped an image by initiating a param and passing the param to _GDIPlus_ImageSaveToFileEx() as in the Help file shows under the _GDIPlus_ParamInit() example.

But I like your method better as it's easier to follow... good job , neato :(

You should write that "GdipImageRotateFlip" into function format and submit it for GDIPlus.au3 UDF

Cheers

Thank you :(

#include <GDIPlus.au3>

Global enum _
    $RotateNoneFlipNone = 0 , _
    $Rotate90FlipNone = 1 , _
    $Rotate180FlipNone = 2 , _
    $Rotate270FlipNone = 3 , _
    $RotateNoneFlipX = 4 , _
    $Rotate90FlipX = 5 , _
    $Rotate180FlipX = 6 , _
    $Rotate270FlipX = 7 , _
    $RotateNoneFlipY = 6 , _
    $Rotate90FlipY = 7 , _
    $Rotate180FlipY = 4 , _
    $Rotate270FlipY = 5 , _
    $RotateNoneFlipXY = 6 , _
    $Rotate90FlipXY = 7 , _
    $Rotate180FlipXY = 0 , _
    $Rotate270FlipXY = 1



_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")
_GDIPlus_ImageRotateFlip($hImage,$Rotate90FlipNone)
 _GDIPlus_ImageSaveToFile ($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg")
_WinAPI_DeleteObject ($hImage)
_GDIPlus_ShutDown ()

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_mageRotateFlip
; Description ...: rotates and flips an image
; Syntax.........: _GDIPlus_mageRotateFlip($hImage,$rfType)
; Parameters ....: $hImage      - Handle to an image object
;                  $rfType   ;[in] Element of the  RotateFlipType enumeration that specifies the type of
;                               rotation and the type of flip.
;
; Return values .: Success      - True
;                  Failure      - False
; ===============================================================================================================================
Func  _GDIPlus_ImageRotateFlip($hImage,$rfType)
Local $aResult
$aResult = DllCall($ghGDIPDll,"int","GdipImageRotateFlip","hwnd",$hImage,"long",$rfType)
If @error Then Return SetError(@error, @extended, False)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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