Jump to content

Recommended Posts

Posted (edited)

I'm truing to do a small program that will simply slice one big (bmp) image to many small parts (32x32 px) and save each part to its own file...

So the question is: whitch functions in autoit can do this, or may help me to do this ? Or maybe some UDF ? =) Or maybe some links to examples ?

============================

Sorry for my bad English...

Edited by Enforcer
[RU] Zone
Posted (edited)

Ye already Found :) Thx eny way

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

Opt('MustDeclareVars', 1)

XSlice()

Func XSlice()
Local $hBitmap, $hClone, $hImage, $iX, $iY

; Initialize GDI library
_GDIPlus_StartUp ()

; Open Bitmap
$hImage = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\TEST.bmp")
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ($hImage)


; Copy Area
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, 32, 32, $GDIP_PXF32RGB)


; Save bitmap to file
_GDIPlus_ImageSaveToFile ($hClone, @MyDocumentsDir & "\SLICEDIMAGE.bmp")

; Clean up resources
_GDIPlus_ImageDispose ($hClone)
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI library
_GDIPlus_ShutDown ()

EndFunc
Edited by Enforcer
[RU] Zone

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