Croping images with no loss using .NET

Posted by zaladane on Stack Overflow See other posts from Stack Overflow or by zaladane
Published on 2010-03-31T02:56:58Z Indexed on 2010/03/31 3:03 UTC
Read the original article Hit count: 301

Filed under:
|
|

I am trying to understand why after croping an image in .NET i end up with an image 3 times the size of the original image. Listed below is the code i am using to crop the image

  Private Shared Function CropImage(ByVal img As Image, ByVal cropArea As Rectangle) As Image
      Dim bmpImage As Bitmap = New Bitmap(img)
      Dim bmpCrop As Bitmap = bmpImage.Clone(cropArea, img.PixelFormat)
      Return CType(bmpCrop, Image)
   End Function

where img is the original image loaded from file into an image object.

How can i achieve a loss less cropping of my image?

© Stack Overflow or respective owner

Related posts about crop

Related posts about images