vtjas.blogg.se

Split picture into grid
Split picture into grid





The code I'm using is this Dim img As Image = Image.FromFile()ĭim widthThird As Integer = CInt(CDbl(img.Width) / 3.0 + 0.5)ĭim heightThird As Integer = CInt(CDbl(img.Height) / 3.0 + 0.5)ĭim bmps As Bitmap(,) = New Bitmap(2, 2) īmps(i, j) = New Bitmap(widthThird, heightThird)ĭim g As Graphics = Graphics.FromImage(bmps(i, j)) I've got a working script that is doing exactly what I want but at I said near the beginning I keep getting this result Private Sub ScaleUp_Click(sender As Object, e As EventArgs) Handles Button2.Click PictureBox3.Top = PictureBox1.Top + PictureBox1.Height + 4

split picture into grid

PictureBox2.Left = PictureBox1.Left + PictureBox1.Width + 4 Private Sub Scale_Click(sender As Object, e As EventArgs) Handles Button1.Click Just click on the image to see the animation. Ayway one way of doing it is this,I only used three pictureboxes for demonstration: What should be the end product? Sliding game? It is hard to give good advice without knowing what the result should look like. PictureBox10.Image = CropBitmap(New Bitmap(PictureBox2.Image), 43, 43, 21, 21)īut when I use this method I get this resultĭoes anyone know of a soulution to fix this? or if there is another script that'll do this? PictureBox9.Image = CropBitmap(New Bitmap(PictureBox2.Image), 43, 22, 21, 22) PictureBox8.Image = CropBitmap(New Bitmap(PictureBox2.Image), 43, 0, 21, 21)

split picture into grid

PictureBox7.Image = CropBitmap(New Bitmap(PictureBox2.Image), 22, 43, 22, 21) PictureBo圆.Image = CropBitmap(New Bitmap(PictureBox2.Image), 22, 22, 22, 22) PictureBox5.Image = CropBitmap(New Bitmap(PictureBox2.Image), 22, 0, 22, 21) PictureBox4.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 43, 21, 21) PictureBox3.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 21, 21, 22) PictureBox1.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 0, 21, 21) Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

split picture into grid

The code I'm currently using is this Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmapĭim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight)ĭim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat)

split picture into grid

I'm wanting to slice a square image into 9 pieces like below







Split picture into grid