Image Crop using aspect ratio RSS

13 replies

Last post Jan 20, 2012 10:54 AM by shobana raja

Member

122 Points

228 Posts

Image Crop using aspect ratio

How to crop and save a image with aspect ratio 4:3 in asp.net C#

• Moved by XIII on Jan 20, 2012 08:39 AM

All-Star

78956 Points

13402 Posts

MVP

Re: Image Crop using aspect ratio

MAK [MVP ASP.Net] ASP.Net Freelancer

Contact me

Member

122 Points

228 Posts

Re: Image Crop using aspect ratio

i need the center crop of the image like in the microsoft picture manager.

Member

75 Points

24 Posts

V.

Member

122 Points

228 Posts

Re: Image Crop using aspect ratio

Do anyone know how to change (any)width and (any)height to standard 4:3 ratio ???????

Participant

1876 Points

347 Posts

Re: Image Crop using aspect ratio

Hi,

There are lots of programs with which you can actually resize/crop an image in C#, the earlier posts can help you with this, coming to the aspect ratio part 4:3 is nothing but standard 1024 X 768 pixels... So in your program you can always set the width to 1024 and height to 768

Here is the link for all aspect ratios http://en.wikipedia.org/wiki/Display_resolution

And remember aspect ratios are calculated by find the greatest common divisor of the resolution.. in this case the 256 is the greatest common divisor of 1024 and 768

256 * 4 is 1024 and 156 * 3 is 768.... So you can very well go ahead and use the above programs to get to the 4:3 ratio...

Thanks

Arun

Member

122 Points

228 Posts

Re: Image Crop using aspect ratio

`   Hi,`
`      Double aspectRatio = 4.0 / 3.0;      int newHeight = (int)((imge.Height) * aspectRatio);      int newWidth = (int)((imge.Width) * aspectRatio);      int cropY = (int)((imge.Height) / 2.0 - newHeight / 2.0);      int cropX = (int)((imge.Width) / 2.0 - newWidth / 2.0);`

`      i have done like this but this is not converting to standard ratio 4:3 and even x and y is not `
`     helping to crop image at the center. Can any one pls help.???`

Member

300 Points

75 Posts

Re: Image Crop using aspect ratio

http://www.dotnetthoughts.net/2009/12/07/image-cropping-in-asp-net-with-jquery/

http://geekswithblogs.net/SanjayU/articles/asp.net-image--photo-cropper-in-c.aspx

All-Star

15171 Points

2509 Posts

Re: Image Crop using aspect ratio

See this link, it will guide you how you can generate good quality thumbnail and image scaling:-

http://zeeshanumardotnet.blogspot.com/2010/06/generate-high-quality-thumbnail-images.html

Thanks,
Zeeshan Umar
~Please Mark As Answer, one or multiple posts, which helped you. So that it might be useful for others~

Member

122 Points

228 Posts