Click here to Skip to main content
13,198,068 members (66,914 online)
Rate this:
Please Sign up or sign in to vote.

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 19-Apr-13 21:31pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

image_handler best solution for your query

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171020.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100