Click here to Skip to main content
16,017,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when I crop an Image using Bitmap.Clone() it creates output larger than the Original Image Size
The Original size is : 5 M
and the Output Cropped image is : 28 M

how can I make cropping without lose quality and with no large size ?
my code is :


C#
private static Image cropImage(Image img, Rectangle cropArea)
       {
           var bmpImage = new Bitmap(img);
           Bitmap bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat);
           img.Dispose();
           bmpCrop.Save(@"D:\Work\CropImage\CropImage\crop.bmp",bmpImage.RawFormat );
           return (Image)(bmpCrop);
       }
Posted
Comments
Jibesh 1-Jan-13 5:20am    
Are they same format? what is the format of the original file??

Read over this, your answer is in there.
Cropping Images[^]
 
Share this answer
 
Idiot because you are saving it as a bitmap
 
Share this answer
 
Comments
Adam R Harris 31-Dec-12 14:27pm    
'Idiot' was uncalled for but yes that is his problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900