简体   繁体   English

无法在C#中加载DLL'EDSDK.dll'Canon Canon错误

[英]Unable to load DLL 'EDSDK.dll' Canon SDK Error in C#

I'm trying to add to an existing website using the Canon SDK and it's resize options. 我正在尝试使用Canon SDK添加到现有网站,并且它是调整大小选项。 I have added the EDSDK.cs to my App_Code folder and these dlls to my Bin directory: EdsImage.dll, EDSDK.dll, MLib.dll, Ucs32P.dll, DPPDLL.dll, DPPLibCom.dll, and DPPRSC.dll. 我已将EDSDK.cs添加到我的App_Code文件夹中,并将这些dll添加到我的Bin目录中:EdsImage.dll,EDSDK.dll,MLib.dll,Ucs32P.dll,DPPDLL.dll,DPPLibCom.dll和DPPRSC.dll。 My code is just trying to convert the image to a JPG file: 我的代码只是试图将图像转换为JPG文件:

uint err;
        err = EDSDK.EdsInitializeSDK();
        IntPtr inStream;
        err = EDSDK.EdsCreateFileStream("img_001.CR2", EDSDK.EdsFileCreateDisposition.OpenExisting, EDSDK.EdsAccess.Read, out inStream);
        IntPtr imgRef;
        err = EDSDK.EdsCreateImageRef(inStream, out imgRef);
        err = EDSDK.EdsSetPropertyData(imgRef, EDSDK.PropID_WhiteBalance, 0, 4, EDSDK.WhiteBalance_Cloudy);
        IntPtr outStream;
        err = EDSDK.EdsCreateFileStream("img_001.jpg", EDSDK.EdsFileCreateDisposition.CreateAlways, EDSDK.EdsAccess.Write, out outStream);
        EDSDK.EdsImageInfo info;
        err = EDSDK.EdsGetImageInfo(imgRef, EDSDK.EdsImageSource.FullView, out info);
        EDSDK.EdsSaveImageSetting set = new EDSDK.EdsSaveImageSetting();
        set.JPEGQuality = 9;
        err = EDSDK.EdsSaveImage(imgRef, EDSDK.EdsTargetImageType.Jpeg, set, outStream);
        EDSDK.EdsRelease(imgRef);
        EDSDK.EdsRelease(inStream);
        EDSDK.EdsRelease(outStream);
        EDSDK.EdsTerminateSDK();

Any help would be greatly appreciated. 任何帮助将不胜感激。 Thank you!! 谢谢!!

I have found a solution to this problem that I wanted to share in case anyone had the same problem. 我发现了一个我想分享的解决方案,以防有人遇到同样的问题。 I downloaded a .exe file here http://www.centrostudiprogressofotografico.it/en/dcraw/ and ran it as a process in the website to convert the .cr2 to a jpg. 我在http://www.centrostudiprogressofotografico.it/en/dcraw/上下载了.exe文件,并将其作为网站中的流程运行,以将.cr2转换为jpg。 Here is the code: 这是代码:

string dcRawExe = HttpContext.Current.Server.MapPath("PATH TO:/dcraw-9.26-ms-64-bit.exe");
string strCR2File = "PATH TO CR2 FILE";
string strJPGFile = "PATH TO JPG FILE";
var startInfo = new ProcessStartInfo(dcRawExe)
{
    Arguments = "-c -e \"" + strCR2File + "\"",
    RedirectStandardOutput = true,
    UseShellExecute = false
};
var process = System.Diagnostics.Process.Start(startInfo);
var image = System.Drawing.Image.FromStream(process.StandardOutput.BaseStream);
image.Save(strJPGFile, System.Drawing.Imaging.ImageFormat.Jpeg);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM