Android Question Split an image into several parts

zed

Active Member
Licensed User
Hi all

I have an 800x800 px image and I would like to slice it into 16 parts of 200x200 px and save the 16 parts.
I have studied a good part of the slicing libraries but nothing really corresponds to what I need.

Anyone have any ideas?
Thank you

Merry Christmas and Happy New Years ;)
 

intellvold

Member
Licensed User
Hi all

I have an 800x800 px image and I would like to slice it into 16 parts of 200x200 px and save the 16 parts.
I have studied a good part of the slicing libraries but nothing really corresponds to what I need.

Anyone have any ideas?
Thank you

Merry Christmas and Happy New Years ;)
Do you mean this?

Screenshot_167171229ss3.png


Slice:
Sub Globals
    'These global variables will be redeclared each time the activity is created.

    Dim myimage As Bitmap
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    myimage.Initialize(File.DirAssets ,"english_n_819575.png")
    
    slice_image(16 ,200,200)
    For Each v As View In Activity.GetAllViewsRecursive
        If (v Is ImageView) Then
            Dim i As ImageView = v
            i.Bitmap = LoadBitmap(File.DirInternal ,v.Tag&".png")
        End If
    Next
    
    
End Sub



Sub slice_image(count As Int , width As Int , height As Int )
    Dim name As Int=-1
    Dim temp_bitmap As Bitmap
    For iy = 0 To (count-1)/4
      
        For ix = 0 To (count-1)/4
            name=name+1
            temp_bitmap=myimage.Crop(ix*width ,iy*height ,width ,height)
            Dim Out As OutputStream
            Out = File.OpenOutput(File.DirInternal, name&".png", False)
            temp_bitmap.WriteToStream(Out, 100, "PNG")
            Out.Close
          
        Next
      
    Next
  
End Sub
 

Attachments

  • intellvold bx.zip
    134.1 KB · Views: 71
Upvote 0

zed

Active Member
Licensed User
Hi
I come home from work and I see a solution to my problem.
this is exactly what i need.
Life is beautiful.
Thank you so much.
It's awesome.
 
Upvote 0

AlexOfOz

Active Member
Licensed User
I went simple when I was making picture puzzles. I simply used PowerPoint to break a picture up into many pieces, then loaded each of those
 
Upvote 0
Top