Jump to content

How to vertically stack images together using auto it

Recommended Posts

Hi, I am doing data analysis.  In doing this I take a screen shot of a particular area of the screen that matches the criteria I have set. Once the program Is done running it has about 60-80 screenshot images.  Each image is about 700 pixels wide and 60 pixels in height.  Instead of looking at each of these images individually is there a way that I can stitch/Merge them altogether using auto it As they are being taken.

For example:

On first image take screenshot
On second image take screenshot and append to first image. Output -->  Image with both screenshots on it (Stacked vertically)
On the third image take screenshot and appended to the image created in the line above. Output --> With all 3 screenshots on it (stacked vertically)

.... and so on.


Any help would be great.  If I can do this it will greatly reduce my work.Thanks.

Edited by rimmi2002
Link to post
Share on other sites

Take a look to this script:

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

$sTempPath = @ScriptDir & "\temp"
$sStackedImagePath = @ScriptDir & "\StackedBitmaps.png"
$iScreenShotNumber = 8 ;Set the screenshots number

If Not FileExists($sTempPath) Then
    DirRemove($sTempPath, 1)

If FileExists($sStackedImagePath) Then

For $i = 0 To $iScreenShotNumber - 1
    _ScreenCapture_Capture($sTempPath & "\" & $i & ".jpg")

    If @error Then
        MsgBox(16, "Error", "Unable to take screenshot")

Global $aFilter = _FileListToArrayRec($sTempPath, "*.jpg;*.png;*.bmp", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH)
If @error Then
    MsgBox($MB_ICONERROR, "Error", "No images were found in selected folder!", 10)


Global $hBitmap_Stacked = _GDIPlus_BitmapCreateStackedBitmaps($aFilter, $iScreenShotNumber)
_GDIPlus_ImageSaveToFile($hBitmap_Stacked, $sStackedImagePath)

DirRemove($sTempPath, 1)
MsgBox($MB_ICONINFORMATION, "Done!", "All done!")

Func _GDIPlus_BitmapCreateStackedBitmaps($aFiles, $iLimit = 5)
    If $aFiles[0] = 1 Then Return SetError(1, 0, 0) ;only one image
    $iLimit = $iLimit > $aFiles[0] ? $aFiles[0] : $iLimit
    Local $i, $aDim, $iW_max = 0, $iH_max = 0, $aImages[$iLimit + 1], $iY = 0
    $aImages[0] = $iLimit
    For $i = 1 To $iLimit
        $aImages[$i] = _GDIPlus_ImageLoadFromFile($aFiles[$i])
        $aDim = _GDIPlus_ImageGetDimension($aImages[$i])
        $iW_max = $aDim[0] > $iW_max ? $aDim[0] : $iW_max
        $iH_max += $aDim[1]
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW_max, $iH_max), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    For $i = 1 To $iLimit
        $aDim = _GDIPlus_ImageGetDimension($aImages[$i])
        _GDIPlus_GraphicsDrawImageRect($hGfx, $aImages[$i], 0, $iY, $aDim[0], $aDim[1])
        $iY += $aDim[1]
    Return $hBitmap
EndFunc   ;==>_GDIPlus_BitmapCreateStackedBitmaps


Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...