Image Resizer 2.0 - Upgrade notes

Behavior changes

  • When both ?width=x&height=y are specified, the default behavior has changed. Instead of stretching the image and losing aspect ratio, whitespace is added (controlled with &bgcolor=color name|code). You can reinstate the original behavor by adding &stretch=fill. Based on customer feedback.
  • ICC profiles are now read on source images, but changes are merged into the image before output. Since most browsers (including Firefox) do not read ICC profiles, this should produce consistent cross-browser behavior. If you want to ignore the original ICC profile for an image, add &ignoreicc=true.
  • The CustomFolders.cs format has changed, and is now much, much more powerful. All querystring commands can be used, and URL rewriting can be performed. (AllowURLRewriting must be true).

New features

Check out the samples page to see these features in action.
  • Automatic cropping and centering can be performed with ?crop=auto&width=x&height=y. You can also choose a crop rectangle from the source image manually with &crop=(x1,y1,x2,y2). Negative values indicate distances relative to the bottom-right corner. (10,10,-10,-10) would crop a 10-pixel border off the source image.
  • Support for 8-bit PNG file output with &colors=2-255. Sets the palette size for both PNG and GIF images.
  • GIF and 8-bit PNG files are now much, much better. Instead of using the GDI default palette, octree quantization is used to calculate the optimal color palette for each image.
  • Upscaling can be enabled using &scale=both. The default is &scale=downscaleonly. &scale=upscaleonly is also available for certain zooming situations.
  • Image rotation is supported in degrees. Ex. &rotate=45. Image sizing is performed before rotation, so rotation will cause the final image size to be larger than the size specified in the querystring.
  • Image flipping can be performed using &flip=h|v|both. To flip the source image before other commands occur, use &sourceFlip=h|v|both.
  • BMP and TIFF source files are now supported.
  • You can add padding around the image with &paddingWidth=px&paddingColor=color|hex. paddingColor defaults to bgcolor, which defaults to white.
  • You can add a border around the image with &borderWidth=px&borderColor=color|hex.
  • Transparency is maintained while resizng PNG files, and when converting from PNG to GIF.
  • DisableCacheCleanup=true|false is now supported in Web.config. If you have plenty of disk space and wish to manually purge old files from the cache, this setting will allow it. Leave the default value to false unless you have a very good reason.
  • DiskCacheAlwaysInvalid=true|false is a new Web.config setting for debugging. It forces every request to update the disk cache before responding. Very, very slow, so make *sure* this is false before you launch.
  • Websites located on UNC paths are now supported. (Ex. \\server\share\website).


  1. Replace the old files with the new files from the ImageResizer folder. If you are using the .DLL, replace the DLL in the bin folder. Keep a copy of your old CustomFolders.cs if you have modified it.
  2. Delete the /imagecache directory.
  3. If you use both width and height to stretch any images, add &stretch=fill to those URLs to maintain the same behavior.
  4. Migrate CustomFolders.cs if you have modified it. The new file includes source comments explaining the process.
If you haven't upgraded to 1.2, follow these instructions first

Published on

About Nathanael

Nathanael Jones is a software engineer, father, consultant, and computer linguist with unreasonably high expectations of inanimate objects. He refines .NET, ruby, and javascript libraries full-time at Imazen, but can often be found on stack overflow or participating in W3C community groups.


If you develop websites, and those websites have images, ImageResizer can make your life much eaiser. Find out more at


I run Imazen, a tiny software company that specializes in web-based image processing and other difficult engineering problems. I spend most of my time writing image-processing code in C#, web apps in Ruby, and documentation in Markdown. Check out some of my current projects.

More articles