Supported image-formats by Windows.Media.BitmapDecoder?

  • Thread starter Johann Löwen
  • Start date
J

Johann Löwen

Hello,

how/where can i get witch image-formats are supported by the
BitmapDecoder-Class on current PC?
 
P

Peter Duniho

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
 
J

Johann Löwen

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
 
P

Peter Duniho

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
 
J

Jesse Houwing

* Peter Duniho wrote, On 6-10-2009 0:43:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top