When we are we are ceating a BitmapSource from an image file. Th code is working on my local system but mot on the staging and live.

It is working under Windows 7, 32 bit, Service Pack1 (my local) and not under windows server 2008R2, 64 bit, Service Pack1 (live and staging). Most of the images having error are color representation as "uncalibrated"

I also checked on Windows 7, 64 bit, Service Pack1 using published code which is on stage and live and its working fine there also.

While decoding the file we are getting and error.

at System.Windows.Media.Imaging.BitmapFrameDecode.get_ColorContexts() at System.Windows.Media.Imaging.BitmapSource.CreateCachedBitmap(BitmapFrame frame, BitmapSourceSafeMILHandle wicSource, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, BitmapPalette palette) at System.Windows.Media.Imaging.BitmapFrameDecode.FinalizeCreation() at System.Windows.Media.Imaging.BitmapFrameDecode..ctor(Int32 frameNumber, BitmapSourceSafeMILHandle sourceHandle, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, BitmapDecoder decoder) at System.Windows.Media.Imaging.BitmapDecoder.SetupFrames(BitmapDecoder decoder, ReadOnlyCollection`1 frames) at System.Windows.Media.Imaging.BitmapDecoder.get_Frames() at DA.Image.CreateBitmap(String filePath) at DigitisedArt.Image.Create(Int32 accountID, Int32 imageID, Int32 batchID, Int32 assetID, Int32 userID, String guid, String filename, String notes)

I am using the following code to create BitmapSource.

BitmapDecoder decoder = null;
string fileExtension = Path.GetExtension(filePath).ToLower();
FileStream fileStream = new FileStream( filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
decoder = JpegBitmapDecoder.Create(fileStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);

Kindly let us know where we are going wrong.