Android Question save two images side to side in one single image

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello All,
I need to grab a pre existing image, generate a qrcode as a second image, set up a canvas, set them side by side and save the canvas as a single image.
What am I doing wrong since I always get an empty image in the right area.
I have tried to set both as the first existing image and always get the second image empty.

B4X:
            Dim Left_Image As Bitmap
            Dim Right_Image As Bitmap
            Dim LeftRect As B4XRect
            Dim RightRect As B4XRect
            Dim QRG As QRGenerator
            Dim Full_image As B4XCanvas
         
            Left_Image.Initialize(Starter.InternalFolder,"left_logo.jpg")
         
            QRG.Initialize(Left_Image.height)
            Right_Image.Initialize3(QRG.Create("teste string"))
         
            Full_image = CreateCanvas(Left_Image.Width + Right_Image.Width, Left_Image.Height)
         
            LeftRect.Initialize(0,0,Left_Image.Width,Left_Image.Height)
            RightRect.Initialize(Left_Image.Width,0,Left_Image.Width,Left_Image.Height)
         
            Full_image.DrawBitmap(Left_image, LeftRect)
            Full_image.DrawBitmap(Right_Image, RightRect)
            Full_image.Invalidate
            Dim Out As OutputStream = File.OpenOutput(Starter.InternalFolder, "full_image.jpg", False)
            Full_image.CreateBitmap.WriteToStream(Out, 100, "JPEG")
            Full_image.Release
            Out.Close
 
Top