Android Question Save rotate Image from ximageview b4a sd_xuiview

Fabio vega

Member
Licensed User
Hello I need save Image rotated. I try to save image rotate in ximageview .

but image save is the same as original..

B4X:
    xImageView1.B4XBitmap = LoadBitmap(dir,filename)
    xImageView1.Rotate(Yrot, Xrot,0)
    
        
        Img= xImageView1.Snapshot
    ór 
        
        Img= xImageView1.B4XBitmap
    
        
    Dim Out As OutputStream
    Out = File.OpenOutput(dir, "File2.jpg", False)
    Img.WriteToStream(Out, 100,   "JPEG")
    Out.Close
 

Quandalle

Member
Licensed User
You can use something like
B4X:
    Dim xui As XUI
    
    Dim img  As B4XBitmap
    img =  xui.LoadBitmap(dir,File)
    img = img.Rotate(90)
            
    Dim Out As OutputStream
    Out = File.OpenOutput(dir, File, False)
    img.WriteToStream(Out, 100,   "JPEG")
    Out.Close
 
Upvote 0

Fabio vega

Member
Licensed User
You can use something like
B4X:
    Dim xui As XUI
  
    Dim img  As B4XBitmap
    img =  xui.LoadBitmap(dir,File)
    img = img.Rotate(90)
          
    Dim Out As OutputStream
    Out = File.OpenOutput(dir, File, False)
    img.WriteToStream(Out, 100,   "JPEG")
    Out.Close

Hello,thanks; But this only rotate the image in one plane no over X o Y as

B4X:
xImageView1.Rotate(Yrot, Xrot,0)

I need, rotete in X,Y,Z and save
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Hello,thanks; But this only rotate the image in one plane no over X o Y as

B4X:
xImageView1.Rotate(Yrot, Xrot,0)

I need, rotete in X,Y,Z and save
Fabio, it should work like this
B4X:
Dim B4XBase As B4XView = xImageView1.GetBase
Dim Image As B4XBitmap = B4XBase.Snapshot
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
try inserting the view into a panel and then capture the panel image
B4X:
Dim B4XBasePanel As B4XView = xImageView1.GetBase.parent
Dim Image As B4XBitmap = B4XBasePanel.Snapshot
 
Upvote 0
Top