B4J Question Inset text at x,y position on Image

TomDuncan

Active Member
Licensed User
Longtime User
Sorry insert not inset
Hi all,

I have this code for cropping an image.

B4X:
Sub Crop_ImageToJPEGByteArray(aImage As Object, x,y,w,h As Int, quality As Int) As Byte()
    'Sanity check incoming image
    Try
        Dim image As B4XBitmap = aImage
    Catch
        td_log("crop " & LastException)
        Return Array As Byte ()
    End Try

    image = image.Crop(x, y, w , h)

    'Convert image to JPEG byte array
    Dim out As OutputStream
    out.InitializeToBytesArray(0)
    image.WriteToStream(out, quality, "JPEG")
    out.Close
 
    'Done
    Return out.ToBytesArray
End Sub

What I need to do is crop the image then insert text onto the bitmap then save it.
Must be easy but this old fella cannot figure it out.
Any easy ideas.

Tom
 
Top