To start, JPEG images use a lossy compression algorithm, so you lose quality when saving in this format. It is advisable to save as a Bitmap (BMP), which is uncompressed, or PNG , which uses lossless compression.
Here is the code to copy the work area of ββthe screen to a PNG image.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click 'the working area excludes all docked toolbars like taskbar, etc. Dim currentScreen = Screen.FromHandle(Me.Handle).WorkingArea 'create a bitmap of the working area Using bmp As New Bitmap(currentScreen.Width, currentScreen.Height) 'copy the screen to the image Using g = Graphics.FromImage(bmp) g.CopyFromScreen(New Point(0, 0), New Point(0, 0), currentScreen.Size) End Using 'save the image Using sfd As New SaveFileDialog() With {.Filter = "PNG Image|*.png", .InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop} If sfd.ShowDialog() = Windows.Forms.DialogResult.OK Then bmp.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Png) End If End Using End Using End Sub
source share