Use BitmapFactory.decodeByteArray()to get Bitmap, then create Canvaswith this bitmap and draw text there. Finally save it using Bitmap.compress():
Bitmap bmp = BitmapFactory.decodeByteArray(myArray, 0, myArray.length).copy(Bitmap.Config.RGBA_8888, true);
Canvas canvas = new Canvas(bmp);
canvas.drawText("Hello Image", xposition, yposition, textpaint);
OutputStream os = new FileOutputStream(dstfile);
bmp.compress(CompressFormat.JPG, 100, os);
os.flush();
os.close();
source
share