Sign in to follow this  
Followers 0
Enforcer

Image slicing

3 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



#3 ·  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

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