You have to write the image to the disk drive, and then call the URL path for it. In the old days, when I was using PHP, we wrote the image to memory, and used webpage to hold the memory stream, and then called the webpage URL to substitute as the image file. But if yo wrote a multi user system, then everyone may get the same image, if used at the same time, so now you have to do some work with unique image names. Why not just make the round corners a head time at just use them? I think you can make a round corner canvas, and place your image over the canvas, and save the combined images.