Updated Image Processing Washington DC

Working on a website in the middle of the night as I usually do is always an interesting and lonely experience. The benefit is that you get a lot done because no one bothers you. The downside is that waking up the next day is never fun.

Local Companies

BoseArts Corporation
(410) 330-1238
124 7th St., SE
Washington, DC
DefCharge Network Systems
240-292-0003
1207 White Cliff Court
Accokeek, MD
Driven Communication
703-299-8999
817 King Street
Alexandria, VA
Lucidea
202-782-1100 x41
1220 L Street NW
Washington, DC
Cunning Web Solutions
(240) 603-1261
DC
10 Notes, LLC
202.553.4000
1510 PARK RD, NW, SUITE 1
WASHINGTON, DC
Eighth Day Design
703-562-3636
1401 Wilson Blvd
Arlington, VA
Stratecomm
(202) 667-7500
1633 Connecticut Ave NW
Washington, DC
Eraglobe Inc
(202) 362-2881
3101 New Mexico Ave NW
Washington, DC
Iapps
(202) 265-3700
2639 Connecticut Ave NW Ste 210
Washington, DC

Working on a website in the middle of the night as I usually do is always an interesting and lonely experience. The benefit is that you get a lot done because no one bothers you. The downside is that waking up the next day is never fun.

This evening I managed to image processing code for our site. Every image - hundreds of thousands of them are passed through that code. It is fun to watch on the server because you can see the images being generated and then cached on the fly. Hundreds of them are generated every second. Pretty cool eh?

The uncool part was that it has had a few problems this last week. We recently received some images from our designers that were in a new format. (Who would have thought that there are so many formats for gif and jpg). At any rate the image processor was choking on some of some of the unsupported formats, throwing an exception, and then spewing out the 'Image Not Found' thumbnail that it likes to spit out when it gets lost.

This of course drove everyone in the office crazy because, well the image was there but the computer was telling then it wasn't.

Its fixed now.

In case you wonder what made the difference here it is:

This was the exception:
A Graphics object cannot be created from an image that has an indexed pixel format.

Here's the documentation from Microsoft

and here is the code I used to deal with the issue:

private Bitmap GetTempImage(int width, int height)
{
Bitmap tempImage;
if(_CurrentImage.PixelFormat == PixelFormat.Undefined ||
_CurrentImage.PixelFormat == PixelFormat.DontCare ||
_CurrentImage.PixelFormat == PixelFormat.Format1bppIndexed ||
_CurrentImage.PixelFormat == PixelFormat.Format4bppIndexed ||
_CurrentImage.PixelFormat == PixelFormat.Format8bppIndexed ||
_CurrentImage.PixelFormat == PixelFormat.Format16bppGrayScale ||
_CurrentImage.PixelFormat == PixelFormat.Format16bppArgb1555)
{
// None of the above types are support so
//just create a bitmap that uses the default pixel format
tempImage = new Bitmap(width, height);
}
else
{
tempImage = new Bitmap(width, height, _CurrentImage.PixelFormat);
}
return tempImage;
}

For more information, go to www.theplancollection.com.

Featured Local Company

BoseArts Corporation

4103301238
124 7th St., SE
Washington, DC

Related Local Event
2009 Design-Build Conference & Expo
Dates: 11/5/2009 - 11/7/2009
Location: Gaylord National
National Harbor, MD
View Details