Click here to Skip to main content
15,891,841 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am using a code that throws a System.Drawing.Bitmap I have written the code below.

C#
public void grab()
       {
           VideoFileReader reader = new VideoFileReader();
           reader.Open(@"C:\\Users\\Zam\\Videos\\Becky G.mp4");
          int FR= reader.FrameRate;

           int x=0;
           while (x < reader.FrameCount)
           {
               var image= reader.ReadVideoFrame();
//or
              System.Drawing.Bitmap bmp =reader.ReadVideoFrame();
// further process on this image 
               }


the line reader.readVideoFrame() returns a bitmap and I tried to catch it using above given both ways but it generates below given error message. Please help me with this.

The base class or interface 'System.MarshalByRefObject' in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.Drawing.Image' could not be resolved c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Drawing.dll
Posted
Comments
Sergey Alexandrovich Kryukov 17-Feb-14 16:46pm    
What exactly have you done to get to this situation? How did you reference this assembly?
—SA

1 solution

I am not developing for Win 8 Store, but I have read you can only use its supported libraries, and System.Drawing is not one of them. See: [^]

There appear to be equivalent bitmap facilities available in the Windows.Graphics.Imaging library for Win 8 Store apps: [^].

Tutorial on processing imaging using that library: [^].

Do examine the articles here on Win 8 Store apps: [^].

You might visit the Windows8/RT forum here on CP: [^], although it has little traffic at present.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 17-Feb-14 18:44pm    
I don't see any convincing reason why System.Drawing could not be used. It might be not very useful or impractical to use, but... If this assembly is deployed at all, it certainly can be used. Your information might be related to the fact that one could not use System.Drawing rendering on the Win 8 Store UI elements. That's true, so what? If you, say, want to create a bitmap, put some graphics on it and save in a file, how any UI framework could prevent doing it? This is just the example...

The "not supported" statement in your first link simply say that Store assemblies cannot be used in different application types (I bet some can be still used; Microsoft documentation never was precise in statements formulated in words). It is totally unrelated to your statement about usability of System.Drawing...

—SA
BillWoodruff 18-Feb-14 9:47am    
It is crystal clear that the Windows.Graphics.Imaging namespace is meant to be used for the type of graphic operations the OP is doing in a Win 8 Store Application, and I believe Microsoft when they say libraries like System.Drawing cannot be used.

But, if you are worried about this, well, get a Win 8.1 machine (required to develop Store Apps), and try it. I would try it, but I haven't moved from Win 8 to Win 8.1 ... yet.
Sergey Alexandrovich Kryukov 18-Feb-14 11:11am    
Facts are more important then all Microsoft's words. If you can see, part of System.Drawing is unrelated to UI frameworks, and this part can be used, not matter what. Can you see the point?
—SA
z3m 18-Feb-14 18:16pm    
Dear Thank you so much for your really good answer.
I still have a question.
The API I am using returns me a System.Drawing.Bitmap I have really tried hard to convert it into Windows.Graphics.Imaging.
Could you please help me to do that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900