I was using the following code to enter an image url at TextBox1 and display it in PictureBox1.Everything worked.

But suddenly the displayed image quality is lower than the original link. I've tried PictureBox1.Load(TextBox1.Text) and changing SizeMode still the same result.

Imports System.Net
    Public Class Form1
        Dim client As WebClient
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            client = New WebClient()

            Dim ImageInBytes() As Byte = client.DownloadData(TextBox1.Text)

            Dim ImageStream As New IO.MemoryStream(ImageInBytes)

            PictureBox1.Image = New System.Drawing.Bitmap(ImageStream)

         End Sub
        End Class

I'm using
Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel Microsoft .NET Framework Version 4.0.30319 RTMRel

How can I get the image to display without the quality loss?

Recommended Answers

All 2 Replies

One thing to take into consideration in packet loss /size of image.

If there is a large amount of packet loss between you and the site - the quality will suffer greatly.

If the size of your picturebox is smaller/larger than the original image there will be stretching or pinching. This causes pixelation.

One thing to take into consideration in packet loss /size of image.

If there is a large amount of packet loss between you and the site - the quality will suffer greatly.

Yep,that's the problem. I tested it using a different internet connection and it worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.