• Welcome to Valhalla Legends Archive.
 

Help w/ a little project of mine...

Started by NetNX, January 28, 2006, 10:28 AM

Previous topic - Next topic

NetNX

i was wondering if there was a way to break an image down into 32x32 squares and then save the individual files..?

Ringo

Quote from: NetNX on January 28, 2006, 10:28 AM
i was wondering if there was a way to break an image down into 32x32 squares and then save the individual files..?
Iv only quickly debugged and tested it, but should give you the right idea :)
This needs 2 picture box controlls and the source image in the aplications path:

    Pic1.AutoSize = True
    Pic1.ScaleMode = 3 'Pixel
    Pic2.ScaleMode = 3 'Pixel
    Pic2.Width = 540 '32
    Pic2.Height = 540 '32
    Pic2.AutoRedraw = True
    Pic1.Picture = LoadPicture(App.Path & "\SomeFile.gif") '.gif/.jpg/.bmp
    Dim i%, i2%
    For i = 0 To Pic1.ScaleHeight Step 32
        For i2 = 0 To Pic1.ScaleWidth Step 32
            Pic2.PaintPicture Pic1, 0, 0, , , i2, i, , , vbSrcCopy
            Set Pic2.Picture = Pic2.Image
            Call SavePicture(Pic2, App.Path & i2 & " by " & i & ".gif") '.gif/.jpg/.bmp
        Next i2
    Next i

Hope this helps

NetNX

Ringo, Where have you been all my life? <3