N Thorell
10/16/2004 8:03:00 PM
I have a similar problem when shrinking an image.
The result is too soft, even with different InterpolationMode filters.
Is looks like I need a sharpening filter. Any hints?
"Steve Bugden" wrote:
> Hello,
>
> I''m trying to obtain a portion of an image and save it as a jpeg file. I
> have some code to do this (attached) which works but the quality of the image
> is not as good as the image created simply by saving the bitmap.
>
> I assume therefore that method I have used to obtain a portion of the image
> causes the degradation. I''m just wondering if it''s possible to obtain a
> portion of an image without losing quality?
>
> Regards,
>
> Steve.
>
>
> Dim clrR As Integer
> Dim clrG As Integer
> Dim clrB As Integer
> Dim x As Integer
> Dim y As Integer
> Dim intHeight As Integer = 100
> Dim intWidth As Integer = 100
>
> ''Size the bitmap
> Dim bmpCopy As New Bitmap(intWidth, intHeight)
> ''Get the image
> Dim bm As Bitmap = Me.PictureBox1.Image
>
> Dim NewX As Integer = 0
> Dim Newy As Integer = 0
>
> For y = 0 To intHeight - 1
> For x = 0 To intWidth - 1
> '' Convert this pixel.
> With bm.GetPixel(x, y)
> clrR = .R
> clrG = .G
> clrB = .B
> End With
> bmpCopy.SetPixel(NewX, Newy, _
> Color.FromArgb(255, clrR, clrG, clrB))
> NewX = NewX + 1
> Next x
> Newy = Newy + 1
> NewX = 0
> Next y
>
> Return bmpCopy