I would use flask and have an endpoint like so:
@app.rooute('/data', methods=['GET'])
def meth():
# python code here
return make_response(jsonify({'results': ret}), 200)
I've actually set up an endpoint for you to use here that takes a png file, uses pillow to resize it to 1200 pixels and returns the new png.
Your task is now to display the PNG however you would in Java.
EDIT: There are many, many approaches to read data from the HTTP endpoint in Java, one is given below, using okhttp:
Request request = new Request.Builder().url("https://hd1-martin.herokuapp.com/data").build();
Response rawResponse = new OkHttpClient().newCall(request).execute();
byte[] response = rawResponse.body().bytes();
This is the limit of my expertise, I'm now leaving the rest in your capable hands to get the new image to display in Android, with the following hint... I suspect you're going to be looking at writing the bytes -- in response in the snippet -- to a file and loading it into an Android ImageView.
Hope that helps.