Tool: Import Pictures for all you Profiles

By | 2010-03-11

Here at Tam Tam we are currently working on implementing SP2010 as our Portal and Customer Portal Platform.

We wanted to have all our Employee profiles to include pictures:

SP2010 stores Profile Pictures in the MySite Host. There is a Picture Library there called “User Photos”. Inside there is a Folder named Profile Pictures. If it is not, it just means no one has uploaded a Profile Picture yet.

Each profile picture comes in three flavours: _LThumb, _MThumb and _SThumb. SP2010 does this for you, through the Profile Property Editor for Profile Pictures.

So, with the help of Reflector, I wrote a small tool that would import all our profile pictures and update the user profiles. I created a small Forms application that would import the profile pictures, based on username.jpg pictures.

The magic hapens here, this code is by Microsoft actually, not me:

using (Bitmap bitmap = new Bitmap(num3, num4, PixelFormat.Format32bppArgb))
                using (Graphics graphics = Graphics.FromImage(bitmap))
                    graphics.CompositingMode = CompositingMode.SourceCopy;
                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                    graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    graphics.DrawImage(original, 0, 0, num3, num4);
                    using (MemoryStream stream2 = new MemoryStream())
                        bitmap.Save(stream2, ImageFormat.Jpeg);
                        stream2.Position = 0L;
                        return folder.Files.Add(fileName, stream2, true);

If you want you can use the tool and the code by going here. It is a research project, not a product!

And now we have profile pictures for Tweets:

Organisational browser:


3 thoughts on “Tool: Import Pictures for all you Profiles

  1. Jeff

    Are there any instructions on how to install your scripts? I cant even find an install guide on the codeplex website. Please advise. Thanks!

  2. Ikram

    This code works so good and the pictures comes through instantly. Thanks.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.