Sign in to follow this  
Followers 0
w123443212004

merge severals jpg or bmp files

12 posts in this topic

Hi,

I would like to know if it's possible to merge severals jpg or bmp with autoit.

Someone can send me a part of similar program or function to help me?

Thanks.

Share this post


Link to post
Share on other sites



Hi,

I would like to know if it's possible to merge severals jpg or bmp with autoit.

Someone can send me a part of similar program or function to help me?

Thanks.

Welcome to the forum. Download Auto3Lib from my signature and run the following script:

#include <A3LGDIPlus.au3>
#include <A3LScreenCap.au3>

Global $iI, $hBitmap, $hGraphic, $hGUI, $hImage, $aSlice[4]

; Capture screen region
$hBitmap = _ScreenCap_Capture("", 0, 0, 400, 400)

; Create GUI
$hGUI = GUICreate("Slicer", 400, 400)
GUISetState()

; Initialize GDI+ library
_GDIP_Startup()

; Slice up screen capture into 4 equal parts
$hImage    = _GDIP_BitmapCreateFromHBITMAP($hBitmap)
$aSlice[0] = _GDIP_BitmapCloneArea($hImage,   0,   0, 200, 200)
$aSlice[1] = _GDIP_BitmapCloneArea($hImage, 200,   0, 200, 200)
$aSlice[2] = _GDIP_BitmapCloneArea($hImage,   0, 200, 200, 200)
$aSlice[3] = _GDIP_BitmapCloneArea($hImage, 200, 200, 200, 200)

; Show each slice
$hGraphic = _GDIP_GraphicsCreateFromHWND($hGUI)
for $iI = 0 to 3
  _GDIP_GraphicsDrawImage($hGraphic, $aSlice[$iI], 100, 100)
  Sleep(2000)
next

; Stitch slices back together again and display
_GDIP_GraphicsDrawImage($hGraphic, $aSlice[0],   0,   0)
_GDIP_GraphicsDrawImage($hGraphic, $aSlice[1], 200,   0)
_GDIP_GraphicsDrawImage($hGraphic, $aSlice[2],   0, 200)
_GDIP_GraphicsDrawImage($hGraphic, $aSlice[3], 200, 200)

; Loop until user exits
do
until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIP_GraphicsDispose($hGraphic )
_GDIP_ImageDispose   ($aSlice[0])
_GDIP_ImageDispose   ($aSlice[1])
_GDIP_ImageDispose   ($aSlice[2])
_GDIP_ImageDispose   ($aSlice[3])
_GDIP_GraphicsDispose($hImage   )
_API_DeleteObject    ($hBitmap  )

; Shut down GDI+ library
_GDIP_ShutDown()

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Welcome to the forum. Download Auto3Lib from my signature and run the following script:

PaulIA you take my breath away with these yours GDI Plus examples!.

That's really SUPER! :)

Share this post


Link to post
Share on other sites

I got this when I tried to run your script:

>"C:\Program Files\AutoIt3\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Program Files\AutoIt3\Examples\MergePix.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

>The system cannot find the file specified.


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

I got this when I tried to run your script:

It's saying that it can't find MergePix.au3. This sounds like a user error to me. :) Try running in SciTE.

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

PaulIA you take my breath away with these yours GDI Plus examples!.

That's really SUPER! :)

The GDI+ stuff is one of those modules that I've had a lot of fun playing with. :)

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

It's saying that it can't find MergePix.au3. This sounds like a user error to me. :) Try running in SciTE.

I was using Scite at the time. And the mergepix.au3 file is in my standard scripts folder. :)

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

I am now trying your script at work and am getting this:

>"C:\Program Files\AutoIt3\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Examples\MergePix.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>11:34:27 Starting AutoIt3Wrapper v.1.8.0

>Running AU3Check (1.54.6.0) from:C:\Program Files\AutoIt3

+>11:34:27 AU3Check ended.rc:0

>Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Examples\MergePix.au3"

C:\PROGRA~1\AutoIt3\Include\A3LWinAPI.au3 (1009) : ==> AutoIt has encountered a fatal crash as a result of:

Unable to execute DLLCall.:

$aResult = DllCall("Kernel32.dll", "int", "FormatMessageA", "int", $iFlags, "hwnd", $pSource, "int", $iMessageID, "int", $iLanguageID, "ptr", $pBuffer, "int", $iSize, "ptr", $vArguments)

+>11:34:28 AutoIT3.exe ended.rc:0

+>11:34:29 AutoIt3Wrapper Finished

>Exit code: 0 Time: 2.286


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

I am now trying your script at work and am getting this:

Latest version of AutoIt?

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Latest version of AutoIt?

3.2.2.0

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

3.2.2.0

Now: Running:(3.2.4.9) and your script works fine! Hard to keep up with the new revs... :)

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Latest version of AutoIt?

Updated PaulIA example for 3.3.0.0 version.

#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include  <GuiConstantsEx.au3>
#Include <WinAPI.au3>

Global $iI, $hBitmap, $hGraphic, $hGUI, $hImage, $aSlice[4]

; Capture screen region
$hBitmap = _ScreenCapture_Capture("", 0, 0, 400, 400)

; Create GUI
$hGUI = GUICreate("Slicer", 400, 400)
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Slice up screen capture into 4 equal parts
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$aSlice[0] = _GDIPlus_BitmapCloneArea($hImage, 0, 0, 200, 200)
$aSlice[1] = _GDIPlus_BitmapCloneArea($hImage, 200, 0, 200, 200)
$aSlice[2] = _GDIPlus_BitmapCloneArea($hImage, 0, 200, 200, 200)
$aSlice[3] = _GDIPlus_BitmapCloneArea($hImage, 200, 200, 200, 200)

; Show each slice
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
For $iI = 0 To 3
    _GDIPlus_GraphicsDrawImage($hGraphic, $aSlice[$iI], 100, 100)
    Sleep(2000)
Next

; Stitch slices back together again and display
_GDIPlus_GraphicsDrawImage($hGraphic, $aSlice[0], 0, 0)
_GDIPlus_GraphicsDrawImage($hGraphic, $aSlice[1], 200, 0)
_GDIPlus_GraphicsDrawImage($hGraphic, $aSlice[2], 0, 200)
_GDIPlus_GraphicsDrawImage($hGraphic, $aSlice[3], 200, 200)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($aSlice[0])
_GDIPlus_ImageDispose($aSlice[1])
_GDIPlus_ImageDispose($aSlice[2])
_GDIPlus_ImageDispose($aSlice[3])
_GDIPlus_GraphicsDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Shut down GDI+ library
_GDIPlus_Shutdown()

Edit: Added #Include <WinAPI.au3>

Edited by Malkey

Share this post


Link to post
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
Sign in to follow this  
Followers 0