asp.net, several dynamic images, gdi+

M

MMS

I have a ASP.NET page where first displays a single imagem I'll call it
original. Then one clicks on a button and the program calls an .aspx
page that applies several image filters for processing. The processed
image has to be displayed on the 2nd image (on the right).

The thing is that, when I click for the 2nd time the button, the first
image appears with the contents of the 2nd. It suppose that the 1st one
stays as the original.


Below is the code:

Button related to process image, in the page:
ImageButton2.ImageUrl = "ft/thresholdbinarization.aspx"
---------------------------------------------------------------------------------------------------------
Load event in the page:

If Not IsPostBack Then
'cache("ICropped") is the original image. I'm trying to
copy it to another cache
Cache("PIm2") = Cache("ICropped")
ImageButton1.ImageUrl = "showcropim.aspx" <- this
represents the original image
End If
-----------------------------------------------------------------------------------------------------

Load event on thresholdbinarization.aspx

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim m As New MemoryStream()
Dim _b As Bitmap

_b = Cache("PIm2")

'1. pass values to function
ThresholdBinarization(_b, 0)

'Response.ClearContent()

Response.ContentType = "image/bmp"

' I save again the content of the cache("PIm2") because
inside of the ThresholdBinarization function, it saves the procesed
image on cache("PIm2") again

_b = Cache("PIm2")


_b.Save(m, ImageFormat.Bmp)

m.WriteTo(Response.OutputStream)

Response.Flush()


End Sub
-------------------------------------------------------------------------------------------------


On the 2nd time I click on the button I also see that the original
image loads first than the processed.

I'm not sure if my mistake would be fixed trying to work with the
buffers.


Any help will be appreciated,
MMS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top