Click here to Skip to main content
16,015,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,

I have a few certain sizes of image displaying areas on my website. If I use image aspect ratio to re size the image and then display on the website according to the display area size then it does resizing in the aspect ratio but the size which is fixed for displaying on the website is lost.

For instance, if the want to display a logo image whose original size in width and height is 250 x 100 but when I re size with aspect ration and display on the website in a square shape then it loses on desired height and width and displays it in smaller in height and stretches in width which apparently looks like lost pixels image. Please note that aspect ratio is maintained principally but the background of the square does not get occupied fully when I upload a rectangle logo image.

I just simply want to display all the logo images in the square shape with the predefined size to fit all the images equally & occupy the full square area and not leave blank space of the square area or the background whatever the size of the image may be.

Thanks in advance.
Posted

1 solution

image_handler best solution for your query

alternative code
Resize-and-Compress-Image-in-Csharp see this also
 
Share this answer
 

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