In one of my articles, Creating an Outlook Task Add-in Solution with Visual Studio 2005 Tools for Office, I show how to assemble a WordML document in code. When assembling the document, I embed some pictures. But, I what if you want to make sure the images are a consistent size? Actually, in a completely different part of the solution, I show how to do this.
The code calls a Web service that does a search and pumps back a collection of XmlNode objects that contain information I want to use in the client-side app. The collection gets passed to a constructor on the client-side. I grab the node that is for the photo and manipulate it from there:
Dim bytes() As Byte
customerPhoto = customerNode.ChildNodes(1).InnerText
bytes = Convert.FromBase64String(customerPhoto)
Dim newBitMap As Bitmap
Dim scaledBitMap As Bitmap
newBitMap = New Bitmap(New MemoryStream(customerPhoto))
scaledBitMap = New Bitmap(newBitMap, New Size(78, 78))
pictBox1.Image = scaledBitMap
You can then re-encode if you wish or use the photo in some other way. I love the .NET Framework for its lucidity in operations like this. The simple stuff should be SIMPLE.
My youngest son, 9 months, gave me a cold last night, so I feel a little rough. He's still very cute though. I noticed that Gina Alexander Handbags uses one of the photos of my boys in its product line ad. It was cool with me, by the way. http://www.ginaalexander.com/candies-regular.htm. Apparently, these bags are all the rage with celebs. Hmm...I'm not sure that's a good thing, actually. BTW: did anyone else see the video of George Galloway, British MP, acting like a cat? Wildly humiliating.
Rock Thought for the Day: I was listening to Jimi Hendrix, "Castles MadeOf Sand". Genious. Then, I went back to Voodoo Child. What a riff with the wah peddle in full swing. I wish he were still here. If you have never heard his pdelic-blues riff in Voodoo Child (slight return), then stop what you are doing, go to your favorite online store, buy the Electric Ladyland CD. It will change your life. Really. More about Bold as Love tomorrow.