hello once again !
could someone tell me how could i save an image that i drew (painted) on it with the same image quality as the original image ?
i'm using this code to save the image :
Using Bmp As New Bitmap(PictureBox4.Image, defaultWidth, defaultHeight)
Using G As Graphics = Graphics.FromImage(Bmp)
G.InterpolationMode = Drawing2D.InterpolationMode.NearestNeighbor
G.PixelOffsetMode = Drawing2D.PixelOffsetMode.Half
G.DrawImage(Bmp, 0, 0, defaultWidth, defaultHeight)
Bmp.Save(str1 & "\" & str2, Imaging.ImageFormat.Jpeg)
Dim myCallback As New Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
Dim myBitmap As New Bitmap(Drawbitmap)
Dim myThumbnail As Image = myBitmap.GetThumbnailImage(100, 60, myCallback, IntPtr.Zero)
myThumbnail.Save(str1.Replace("Saved", "Thumbnails") & "\" & str2)
Bmp.Dispose()
End Using
End Using
the thing is the original image has 1920x1080 ,when i load the image into a picturebox i use the bellow code to scale the bitmap to fit the picturebox :
Dim PicBoxHeight As Integer
Dim PicBoxWidth As Integer
Dim ImageHeight As Integer
Dim ImageWidth As Integer
Dim TempImage As Image
Dim scale_factor As Single
PictureBox4.SizeMode = PictureBoxSizeMode.Normal
PicBoxHeight = PictureBox4.Height
PicBoxWidth = PictureBox4.Width
TempImage = Image.FromFile(str)
defaultWidth = TempImage.Width
defaultHeight = TempImage.Height
ImageHeight = TempImage.Height
ImageWidth = TempImage.Width
scale_factor = 1.0
If ImageHeight > PicBoxHeight Then
scale_factor = CSng(PicBoxHeight / ImageHeight)
End If
If (ImageWidth * scale_factor) > PicBoxWidth Then
scale_factor = CSng(PicBoxWidth / ImageWidth)
End If
PictureBox4.Image = TempImage
Dim bm_source As New Bitmap(PictureBox4.Image)
Dim bm_dest As New Bitmap( _
CInt(bm_source.Width * scale_factor), _
CInt(bm_source.Height * scale_factor))
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
gr_dest.DrawImage(bm_source, 0, 0, _
bm_dest.Width + 1, _
bm_dest.Height + 1)
PictureBox4.Image = bm_dest
As you can see the image it's scaled to a lower resolution and when i finish drawing on it and click the save button , it re-sizes the bitmap to the original's image
Using Bmp As New Bitmap(PictureBox4.Image, defaultWidth, defaultHeight)
resolution and saves the image . But the image is saved with a blur over it and each time i re-save that image it keeps adding more blur to it. How could i prevent the blur from applying on the saved image.Thank you !