-
Doesn't exist?
The type or namespace name 'GetEncoderInfo' does not exist in the namespace 'System.Drawing.Imaging' (are you missing an assembly reference?)
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
....
....
ImageCodecInfo jpegCodec = GetEncoderInfo("image/jpeg");
....
....
Last I checked, GetEncoderInfo is in System.Drawing.Imaging. What is the problem here?
Edit: I do have System.Drawing referenced.
-
GetEncoderInfo is a method call. System.Drawing.Imaging is a namespace. A namespace doesn't contain methods, only classes contain methods. You are missing a classname.
-
Okay. Do you know which class GetEncoderInfo is in? Been over google and all codes are using it the same way I am.
-
-
Finished an alpha version. The quality is poor because I can't use GetEncoderInfo(), but it works great.
It updates every 15 seconds with all of the programs of interest I'm running.
http://processes.no-ip.org/Processes.jpg
-
I think you could use ImageCodecInfo.GetImageEncoders() and search the array for the encoder you're looking for.
-
Code:
EncoderParameter quality = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100);
EncoderParameters Params = new EncoderParameters(1);
Params.Param[0] = quality;
ImageCodecInfo[] myCodecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo jpegCodec = myCodecs[1];
-> WholeImage.Save(@"C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/Processes.jpg", jpegCodec, Params); // Problem code.
WholeImage.Dispose();
Code:
System.ArgumentException was unhandled
Message="Parameter is not valid."
Source="System.Drawing"
StackTrace:
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at ProgramList.CreateList.SaveImage() in C:\Documents and Settings\Ryan\My Documents\Visual Studio 2005\Projects\ProgramList\ProgramList\Program.cs:line 86
at ProgramList.CreateList.ProcessImage() in C:\Documents and Settings\Ryan\My Documents\Visual Studio 2005\Projects\ProgramList\ProgramList\Program.cs:line 112
at ProgramList.Program.Main(String[] args) in C:\Documents and Settings\Ryan\My Documents\Visual Studio 2005\Projects\ProgramList\ProgramList\Program.cs:line 122
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
-
Enter GetEncoderInfo in Google and click the first MSDN link that pops up. The example on that page uses a custom method called GetEncoderInfo to do exactly what you need.