house plans
Thanksgiving Sale: 10% Off All Plans. Use Promo Code THANK14 at checkout. Ends 12/1. Plus - Free shipping.
Question or to order
Home >> Technology >> Article
Search entire site
DREAM. LEARN. DISCOVER... GET STARTED.
Technology
Technology

Updated Image Processing

Tags : ,
Published On : 01-29-2008
Author : Steve Donegan
2044 Views
ShareThis

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;
        }

COMMENTS
RELATED ARTICLES
Updated Image Processing
Technology

Search House Plans

Bedrooms
 1  2  3  4  5+
Bathrooms
 1  1½  2  2½  3  3½  4+
Stories Garage Bays
 1  1½  2  1  2  3+
Square Feet
to
View Results
Enter Plan #:
HOUSE PLANS 101
FAQ
Glossary of Terms
Understanding Blueprints
Understanding Copyright
What's included in a set of house plans?
Why pre-drawn house plans?
MOST POPULAR ARTICLES
Plans with Indoor Basketball Courts
House Plans
Building a home plan with an indoor basketball court
House Plans
1. Building on slab vs. crawl space vs. basement? Advantages / disadvantage
House Plans
Garage Plans with Shops, Mother In-Law Suites, Apartments and Bonus Square Footage
House Plans
Luxurious Mountain Craftsman House Plans
House Plans
XML Encoding Problems - Hexadecimal Value 0x1A, is an Invalid Character
Technology
Beachfront, Coastal and Key West Home Plans
House Plans
The Finest Duplex, Town House, and Multi Unit Home Plans
House Plans
European and Luxury House Plans, Large and Small!
House Plans
The In-Law Suite Revolution
House Plans
ARTICLES BY TOPIC
A Frame House Plans A Home Builders Opinion Air Conditioning Tips Architecture beachfront house plans Beachfront Houseplans blueprints building log building lots building mistakes bungalow Bungalow House Plans Cape Cod House Plans celebrity home designs Coastal House Plans Color Photos Color Schemes Considerations for Building Foundations in a New House Plan Contemporary Style country house plans craftsman house plans Curb Appeal Custom vs Stock House Plans Customer Service
RECENT ARTICLES
Built-in Storage Tips for Your New House Plan
House Plans
Make Your Thanksgiving Home Décor Fun and Fanciful
House Plans
Home Design Trends to Watch For in 2015
House Plans
The Right Appliances for your New Home Plan
House Plans 101
The Open Floor Plan: Stylish Living without Walls
House Plans
Regional Trends in Single Family Homes: Size, Price and Design Features Vary
House Plans 101
What to Expect from a New Home Inspection
House Plans 101
Pacific Northwest Style Adapts Architectural Designs to Region’s Landscape & Climate
House Plans
Put Some Halloween Magic and Mystery in Your Home
House Plans
Window Designs for Your New House Plan
House Plans 101
© 2014 The Plan Collection, LLC