TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sudeep gusain
NA
3
1.8k
Error creating BitmapSource object
Jul 31 2013 10:05 AM
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.
Reply
Answers (
2
)
gridview problem
System.Web.HttpRequestValidationException