ASP.NET - Impresion de Puntos sobre Imagen Asp.net

 
Vista:

Impresion de Puntos sobre Imagen Asp.net

Publicado por Pcorral (1 intervención) el 23/08/2016 01:50:03
Buenas tardes amigos saben como dibujar puntos sobre un imagen con cordenadas X,Y en Asp ya que quiero dibujar unos puntos sobre una imagen pero no le encuentro solucion. agradeceria su respuesta gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Impresion de Puntos sobre Imagen Asp.net

Publicado por anonymous (3 intervenciones) el 25/08/2016 18:38:34
Una opción es utilizar la función SetPixel de bitmap.

Esta función tiene como parámetros las coordenadas X e Y de la imagen y el color del punto.

Te dejo un poco de código que he escrito donde además he pintado una línea recta:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'Coger la imagen inicial
Dim bitmapImagen As New System.Drawing.Bitmap(Server.MapPath(aspImage.ImageUrl))
'Dibujar puntos
bitmapImagen.SetPixel(10, 10, System.Drawing.Color.Red)
bitmapImagen.SetPixel(12, 14, System.Drawing.Color.Yellow)
bitmapImagen.SetPixel(14, 12, System.Drawing.Color.Orange)
bitmapImagen.SetPixel(5, 5, System.Drawing.Color.Blue)
'Dibujar una línea
Dim grafico As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bitmapImagen)
grafico.DrawLine(New System.Drawing.Pen(System.Drawing.Color.Red), New System.Drawing.Point(20, 20), New System.Drawing.Point(100, 50))
'Pintar la nueva imagen
Dim memoryStream As New System.IO.MemoryStream()
bitmapImagen.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png)
Dim datosEnBase64 = Convert.ToBase64String(memoryStream.ToArray())
aspImage.ImageUrl = "data:image/png;base64," + datosEnBase64

1
<asp:Image runat="server" ID="aspImage" ImageUrl="Images/imagen.jpg"  />

Espero que te sirva
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar