Unsupported color model... C1Image and C1GifImage

Silverlight

Collaborate with ComponentOne technical experts and fellow developers.

Unsupported color model... C1Image and C1GifImage

  • rated by 0 users
  • This post has 6 Replies |
  • 1 Follower
  • I'm trying to implement GIF capability in a project and when loading certain jpg files I'm getting the following error:

    Message: Unhandled Error in Silverlight 2 Application Code: 4004 Category: ManagedRuntimeError Message: System.NotSupportedException: Unsupported color model... at C1.Silverlight.Imaging.JpgCodec.DecodeInternal(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.JpgCodec.Decode(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.C1Bitmap.SetStream(Stream stream) at C1.Silverlight.Imaging.C1GifImage.SetSource(Stream stream) at C1.Silverlight.Imaging.C1GifImage.wc_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e) at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e) at System.Net.WebClient.OpenReadOperationCompleted(Object arg)

    I am creating a C1GifImage object and setting the UriSource to a url on the internet. I'm then setting the source of a C1Image tag to this C1GifImage object. Has anyone seen this? Do I need to do some processing after the OpenReadOperationCompleted event fires?

    Thanks,
    Brent

  • I was able to capture the and prevent a crash by listening for the ImageFailed event from the MS Image component. Unfortunately it seems there is not an equivalent event dispatched by the C1Image component. Does anyone know how I can at least handle/trap this error using C1?
  • The current Jpeg decoder (we use the one from fjcore) doesn't support grayscale and cmyk color models. We had this on our todo list, but never got around to it because it had low priority (no customer had asked for it). Now with SL3 we might not need to improve the decoder, it's possible to decode a JPEG using WriteableBitmap, so we might just do that.

    Can you post the image you were trying to decode? It would help us with testing.

  • bbonet:
    Unfortunately it seems there is not an equivalent event dispatched by the C1Image component. Does anyone know how I can at least handle/trap this error using C1?
    Good point, we should have that event. I'll add this to the todo list.
  • We're loading a large number of images from a photobrowsing service. If there was an event I could latch onto I could try to get the image url for you.

    One of the main issues I've had using the C1 Imaging components is that they do not match the MS component object structure.

    For example, I'm able to use the Image.ImageFailed event to catch any load errors, but the C1Image component does not have an ImageFailed event.

    Also the Image.DownloadProgress event has a signature of void Image_DownloadProgress(object sender, DownloadProgressEventArgs e). The C1Image.DownloadProgress event uses the DownloadProgressChangedEventArgs. With those args MS uses DownloadProgressEventArgs.Progress and the DownloadProgressChangedEventArgs uses a ProgressPercentage property.

    This all makes my life difficult.

  • Here's another error:

    Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; eMusic DLM/4) Timestamp: Wed, 27 May 2009 23:22:34 UTC Message: Unhandled Error in Silverlight 2 Application Code: 4004 Category: ManagedRuntimeError Message: System.BadImageFormatException: Unknown block type. at C1.Silverlight.Imaging.GifCodec.DecodeInternal(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.GifCodec.Decode(C1Bitmap bmp, Stream stream) at C1.Silverlight.Imaging.C1Bitmap.SetStream(Stream stream) at C1.Silverlight.Imaging.C1GifImage.SetSource(Stream stream) at C1.Silverlight.Imaging.C1GifImage.wc_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e) at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e) at System.Net.WebClient.OpenReadOperationCompleted(Object arg) Line: 53 Char: 13 Code: 0 URI: http://localhost/PBPhotoBrowser.Web/PBPhotoBrowserTestPage.html

    It's looking like there are some errors that are occurring while decoding. Invalid images are fine and dandy but I REALLY need to be able to trap these errors so my app doesn't randomly crash. Can you help me with this? Thanks, Brent

  • Patched C1.Silverlight.Imaging included in this post.
Page 1 of 1 (7 items)