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 (my local) and not under windows server 2008R2(live and staging). Most of the images having error are color representation as "uncalibrated"
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);
fileStream.Close();
(BitmapSource)decoder.Frames[0];
Kindly let us know where we are going wrong.
Loading
sudeep gusainPosted Aug 2, 2013, 2:09 AM
2. The Server and my local is Service Pack 1
3. My local is 32 bit and server is 64 bit (I have checked in in 64 bit system also and is working fine there)
I have checked the other "uncalibrated" images uploaded from system and found that when I these images doesn't have color profile as "uncalibrated" when I open there properties from the window explorer.
Posted Jul 31, 2013, 10:16 AM
1) Make sure your application is complied for X64 or Any CPU.
2) Does you windows 7 machine is 64 bit or 32 bit?
3) I hope your servers are based on 64 bit?
4) Make sure, the Framework versions are matching including SP with your local + server.