Skip to content
gpeipman edited this page Sep 26, 2010 · 5 revisions

Resize image is sample solution that demonstrates how to resize images in ASP.NET applications without markable loss in quality. I wrote this sample application because there are lot of examples available in web where this simple thing is done completely wrong using embedded thumbnails that some devices embed into photos. Currently there are two resizing methods - resizing by scale factor and creating square image like avatars.

Resize by scale factor" demonstration guide

  • Open images folder in Visual Studio and make sure that file original.jpg opens correctly. Then close this file.
  • Run application.
  • When application is opened in browser click [Create thumbnail] button under "Resize image, scale factor = 0.1" title.
  • Close application and check images folder.
  • There is now file called original_thumb.jpg that is ten times smaller by dimensions as original.
  • Note that thumbnail has good quality.

Create avatar image" demonstration guide

  • Open images folder in Visual Studio and make sure that file original.jpg opens correctly. Then close this file.
  • Run application.
  • When application is opened in browser click [Create thumbnail] button under "Resize image, square a = 100px" title.
  • Close application and check images folder.
  • There is now file called avatar.jpg that is ten times smaller by dimensions as original.
  • Note that thumbnail has good quality and image is square with side length 100px.

References