0

I have a Delphi program built around the edsdk. I can take the picture, download the direct jpg of raw files. But when I get a raw (CR2)-file, I can't display the result. Any solution to achieve this would do, but my latest try was to follow this answer as I have difficulties translating the c#-code of most other examples to Delphi. This I what I have now:

procedure   TShooter.JPegFromRaw(rawFileName, JPegFileName: TFileName);
var rawStream, jpgStream: EdsStreamRef;
    imgRef: EdsImageRef;
    imageInfo: EdsImageInfo;
    jpgQuality: EdsSaveImageSetting;
begin
    try
        jpgQuality.JPEGQuality      := 9;
        jpgQuality.iccProfileStream := nil;
        jpgQuality.reserved         := 0;

        raiseError(EdsCreateFileStream(PChar(rawFileName),
                                   kEdsFileCreateDisposition_OpenExisting,
                                   kEdsAccess_Read, rawStream));
        raiseError(EdsCreateFileStream(PChar(JPegFileName),
                                   kEdsFileCreateDisposition_CreateAlways,
                                   kEdsAccess_Write, jpgStream));

        raiseError(EdsCreateImageRef(rawStream, imgRef));
        raiseError(EdsGetImageInfo(imgRef, kEdsImageSrc_FullView, imageInfo));
        raiseError(EdsSaveImage(imgRef, kEdsTargetImageType_Jpeg, jpgQuality, jpgStream));

    finally
        raiseError(EdsRelease(jpgStream));
        raiseError(EdsRelease(rawStream));
        raiseError(EdsRelease(imgRef));
    end { try };
end;

When executing this, it throws EDS_ERR_INVALID_HANDLE in the last line (EdsSaveImage(...)). The line before that doesn't really contribute to the result, but since it also uses imgRef, I have left it there. Since it returns ERR_OK, I assume imgRef is correct. But then I am lost what else could cause the error.

1 Answer 1

0

Raw image support has been removed with SDK version 3.2

I think you are supposed to use DPP (Digital Photo Professional) now. In earlier versions, DPP was shipped together with the SDK and the raw image functions simply used that in the background.

Sign up to request clarification or add additional context in comments.

5 Comments

I am using 2.7, so that should not be the issue.
@user508402 then from the looks of it, it should work. I don't know delphi though so I can't say for sure, but perhaps one of the SDK calls don't work like you expect them to. Can you confirm that you get non-zero pointers for all the streams and image references?
Sure I can. EdsGetImageInfo would not have worked otherwise, but it returns a meaningful result.
I wondered if the iccProfile-stream could be the cause and opened a fileStream from AdobeRGB1998.icc, but to no avail.
EdsImage.dll always is included in the SDK, but EDSDK.dll does not use it. By the looks of it, it just might contain the necessary functions, but where to find the header file? Version 3.2 raises a not supported indeed, as per doc. I Find that the doc is not entirely reliable, as it says that xp-support ended with v. 2.15, which it did not (3.2 still usable, 3.6 is not).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.