I was looking for functionality in which I just need to throw jpg file after changing it into memory.
One way is, save it to hard drive and then use it as target of some img tag. But this is not a good idea, so searched for such kind of logic where I can directly throw the image to client.
I used following code
//Load the bitmap image
System.Drawing.Bitmap objBitMapOriginal = new System.Drawing.Bitmap(strImagePath);
//Change the bitmap image
System.Drawing.Bitmap = ScaleAndModifyImage(objBitMapOriginal);
//Save it to response
But this has some problem as images saved in OutputStream I cant show any other literals or data on the same response.
Then I found a solution, First store the image in session and dynamically sets the src of image which at the end pointing to same page, on requesting that image src it throws the image which is in memory and after finishing work just flush the session.
Its fairly simple, have a look at the delicious. You can also find the code.