Valhalla Legends Forums Archive | Visual Basic Programming | Help w/ a little project of mine...

AuthorMessageTime
NetNX
i was wondering if there was a way to break an image down into 32x32 squares and then save the individual files..?
January 28, 2006, 4:28 PM
Ringo
[quote author=NetNX link=topic=14037.msg143528#msg143528 date=1138465688]
i was wondering if there was a way to break an image down into 32x32 squares and then save the individual files..?
[/quote]
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:
[code]
    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
[/code]
Hope this helps
January 28, 2006, 7:35 PM
NetNX
Ringo, Where have you been all my life? <3
January 30, 2006, 12:06 AM

Search