views:

28

answers:

1

We are using asp.net with .net 4.0

We want to allow users to upload any image and we want to create tiny avatar for uploaded image?

What is the best way to convert uploaded images for avatar?

  • We want to keep the same height width ratio
  • if we can convert gif, bmp, jpg, png to one standard format it would be greate. Which could be the best format to convert it to? i think converting gif would be best option. am i correct?
  • any open source option i can look at
+1  A: 

You can use Gravatar.

To do it yourself, you can use System.Drawing.dll to create and resize a Bitmap object.

SLaks
We already use for end users, but i am looking my own solution for something internal data. like product logos
mamu
+1 for System.Drawing.Image - make sure to check out its static From* methods (it'll figure out format), its 2-param Save method that lets you specify format (i'd pick png for alpha support), and it sounds like GetThumbnailImage might be a good fit for your 'create tiny avatar' bit
James Manning