How could I programatically generate an image (ie output_file.png) which is a combination of user input (ie. strings) overlaid on top of another image file?
Hopefully the image below can illustrate it better
How could I programatically generate an image (ie output_file.png) which is a combination of user input (ie. strings) overlaid on top of another image file?
Hopefully the image below can illustrate it better
Do you actually need to create an image? Are you trying to save it/share it or just display text overlaying an image?
If you just need to overlay, you can set a textview to overlay the image using a RelativeLayout.
If you want to save and share the image, you should take a look at How to programmatically take a screenshot in Android?
To write text directly into a bitmap you can do something similar to the following:
int textSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, context.getResources().getDisplayMetrics());
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setStyle(Paint.Style.FILL);
paint.setTextSize(textSize);
paint.setColor(Color.WHITE);
Canvas myCanvas = new Canvas(myBitmap);
myCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
myCanvas.drawText(string, x, y, paint);
To write the bitmap to a file you can read the answer to this question here: Convert Bitmap to File