Jump to content

Image slicing / resizing


Recommended Posts

I'm trying to make a project where I have several large images that I need to slice up into smaller pieces. I am looking around but I am not seeing anything in autoit that can handle slicing images. I've seen a post towards resizing an image but can this also be done in Autoit?

I need both functions if possible, preferable the 1st, image slicer.

Thanks!

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Link to comment
Share on other sites

I'm trying to make a project where I have several large images that I need to slice up into smaller pieces. I am looking around but I am not seeing anything in autoit that can handle slicing images. I've seen a post towards resizing an image but can this also be done in Autoit?

I need both functions if possible, preferable the 1st, image slicer.

Thanks!

Using Auto3Lib:

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

Global $hBitmap, $hImage, $aSlice[4], $iSliceX, $iSliceY, $iI

; Capture screen
$hBitmap = _ScreenCap_Capture("")

; Initialize GDI+ library
_GDIP_Startup()

; Slice up into 4 parts
$hImage  = _GDIP_BitmapCreateFromHBITMAP($hBitmap)
$iSliceX = @DesktopWidth  / 2
$iSliceY = @DesktopHeight / 2
$aSlice[0] = _GDIP_BitmapCloneArea($hImage, 0       , 0       , $iSliceX, $iSliceY, $GDIP_PXF24RGB)
$aSlice[1] = _GDIP_BitmapCloneArea($hImage, $iSliceX, 0       , $iSliceX, $iSliceY, $GDIP_PXF24RGB)
$aSlice[2] = _GDIP_BitmapCloneArea($hImage, 0       , $iSliceY, $iSliceX, $iSliceY, $GDIP_PXF24RGB)
$aSlice[3] = _GDIP_BitmapCloneArea($hImage, $iSliceX, $iSliceY, $iSliceX, $iSliceY, $GDIP_PXF24RGB)

; Save slices
for $iI = 0 to 3
  _GDIP_ImageSaveToFile($aSlice[$iI], "C:\A3LSlice" & $iI & ".bmp")
  _API_DeleteObject($aSlice[$iI])
next

; Clean up resources
_GDIP_ImageDispose($hImage )
_API_DeleteObject ($hBitmap)
_GDIP_ShutDown()
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

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