From: Johann Löwen on 5 Oct 2009 08:54 Hello, how/where can i get witch image-formats are supported by the BitmapDecoder-Class on current PC?
From: Peter Duniho on 5 Oct 2009 13:29 On Mon, 05 Oct 2009 05:54:01 -0700, Johann Löwen <JohannLwen(a)discussions.microsoft.com> wrote: > how/where can i get witch image-formats are supported by the > BitmapDecoder-Class on current PC? There's no such class as "Windows.Media.BitmapDecoder". Did you mean "System.Windows.Media.Imaging.BitmapDecoder"? If so, at least at present, the question doesn't make a lot of sense. All of the BitmapDecoder sub-classes that exist in .NET have been present since any BitmapDecoder existed. If you have BitmapDecoder support at all, all the formats that are supported in the most recent .NET are supported in any version of .NET. Even if and when new BitmapDecoder sub-classes are provided, it's not clear to me that determining which are supported is all that useful. The point of the .NET imaging model is that you provide a stream of bytes in some form, and it figures out what kind of image it is on your behalf. So normally, you just tell .NET to interpret the stream as an image; if it succeeds, it's supported. If not, it's not. Pete
From: Johann Löwen on 5 Oct 2009 15:19 Hello, yes i mean this class "System.Windows.Media.Imaging.BitmapDecoder". I ask because i can open image-formats with this class witch are no presented in the "System.Windows.Media.Imaging" Namespace. I have install at my PC an Canon Codec to show "CR2"-Files in the Windows explorer and with the "Windows Live Fotogallery" and with this installation i was able to open the "CR2"-Files to with the "System.Windows.Media.Imaging.BitmapDecoder". And would like to know witch image formats i can open on the pc i run my App. With best regards Johann Löwen "Peter Duniho" wrote: > On Mon, 05 Oct 2009 05:54:01 -0700, Johann Löwen > <JohannLwen(a)discussions.microsoft.com> wrote: > > > how/where can i get witch image-formats are supported by the > > BitmapDecoder-Class on current PC? > > There's no such class as "Windows.Media.BitmapDecoder". Did you mean > "System.Windows.Media.Imaging.BitmapDecoder"? > > If so, at least at present, the question doesn't make a lot of sense. All > of the BitmapDecoder sub-classes that exist in .NET have been present > since any BitmapDecoder existed. If you have BitmapDecoder support at > all, all the formats that are supported in the most recent .NET are > supported in any version of .NET. > > Even if and when new BitmapDecoder sub-classes are provided, it's not > clear to me that determining which are supported is all that useful. The > point of the .NET imaging model is that you provide a stream of bytes in > some form, and it figures out what kind of image it is on your behalf. So > normally, you just tell .NET to interpret the stream as an image; if it > succeeds, it's supported. If not, it's not. > > Pete >
From: Peter Duniho on 5 Oct 2009 18:43 On Mon, 05 Oct 2009 12:19:02 -0700, Johann Löwen <JohannLwen(a)discussions.microsoft.com> wrote: > Hello, > > yes i mean this class "System.Windows.Media.Imaging.BitmapDecoder". I ask > because i can open image-formats with this class witch are no presented > in > the "System.Windows.Media.Imaging" Namespace. I have install at my PC an > Canon Codec to show "CR2"-Files in the Windows explorer and with the > "Windows Live Fotogallery" and with this installation i was able to open > the > "CR2"-Files to with the "System.Windows.Media.Imaging.BitmapDecoder". > > And would like to know witch image formats i can open on the pc i run my > App. As far as I know, there's no support in WPF to do this directly. Using the unmanaged API, you should be able to retrieve that information using the IWICImagingFactory.CreateComponentEnumerator() method. I haven't tried it myself, but it looks like what you want: http://msdn.microsoft.com/en-us/library/ms736011(VS.85).aspx I also came across this library, that seems to be a sort of .NET add-on in which you might be able to find some classes supporting your usage: http://code.msdn.microsoft.com/WindowsAPICodePack Again, I haven't looked closely at it, but it seems like it might suit your needs. Beyond that, I'd say that to some extent one's code shouldn't really need to know what codecs are installed. The real question is "can I open this file?", and the best way to determine that is to try. It could fail for a variety of reasons, including lack of an appropriate codec, and so having your own code try to enumerate all the possible reasons it could fail and anticipate those reasons before trying is just a waste of time and effort on your part. Pete
From: Jesse Houwing on 5 Oct 2009 19:24 * Peter Duniho wrote, On 6-10-2009 0:43: > On Mon, 05 Oct 2009 12:19:02 -0700, Johann Löwen > <JohannLwen(a)discussions.microsoft.com> wrote: > >> Hello, >> >> yes i mean this class "System.Windows.Media.Imaging.BitmapDecoder". I ask >> because i can open image-formats with this class witch are no >> presented in >> the "System.Windows.Media.Imaging" Namespace. I have install at my PC an >> Canon Codec to show "CR2"-Files in the Windows explorer and with the >> "Windows Live Fotogallery" and with this installation i was able to >> open the >> "CR2"-Files to with the "System.Windows.Media.Imaging.BitmapDecoder". >> >> And would like to know witch image formats i can open on the pc i run my >> App. > > As far as I know, there's no support in WPF to do this directly. Using > the unmanaged API, you should be able to retrieve that information using > the IWICImagingFactory.CreateComponentEnumerator() method. I haven't > tried it myself, but it looks like what you want: > http://msdn.microsoft.com/en-us/library/ms736011(VS.85).aspx > > I also came across this library, that seems to be a sort of .NET add-on > in which you might be able to find some classes supporting your usage: > http://code.msdn.microsoft.com/WindowsAPICodePack > > Again, I haven't looked closely at it, but it seems like it might suit > your needs. > > Beyond that, I'd say that to some extent one's code shouldn't really > need to know what codecs are installed. The real question is "can I open > this file?", and the best way to determine that is to try. It could fail > for a variety of reasons, including lack of an appropriate codec, and so > having your own code try to enumerate all the possible reasons it could > fail and anticipate those reasons before trying is just a waste of time > and effort on your part. But then again, it is always nice to show the list of supported formats in the File Picker dialog... It makes it easier to know which formats actually are supported and which not. Would have been better if the Media.Imaging namespace came with its own set of pre-configured file pickers to solve that issue. It would be great add-on actually. I haven't had a look at Paint.NET in ages, but there might be functionality in there that also suits your needs. -- Jesse Houwing jesse.houwing at sogeti.nl
|
Pages: 1 Prev: Beta Available for CAX, a caching API for XML Next: Serialization problem |