Author |
Topic |
|
jenswahl
Germany
71 Posts |
Posted - Feb 17 2016 : 01:15:48
|
Hello,
I wrote a sample program using your CameraGetImages as template. It works fine with Jpeg files. The problem are camera raw files (I have a Canon SX50, so the files are *.cr2). On the memory card inside the camera are some *.jpg and some *.cr2 files for testing. Here are my questions: 1. If I click on a cr2-file I get the ExifThumbnail but not the image in a larger size in ievMain. But it works with Jpeg files. Here is the code (ievMain shows the images larger, ievCam is for the Exif thumbnails):
procedure TfMainImRa.stvCamChange(Sender: TObject; Node: TTreeNode);
var
sExt: String;
begin
ievMain.Clear;
ievMain.Update;
//sExt will get correctly '.jpg' or '.cr2'
sExt := ievMain.IO.WIAParams.GetItemProperty(WIA_IPA_FILENAME_EXTENSION, TIEWiaItem(Node.Data));
ievMain.IO.WiAParams.SaveTransferBufferAs := '';
//it works fine in all cases
ievMain.IO.WiaParams.GetItemThumbnail( TIEWiaItem(Node.Data), ievCam.IEBitmap );
ievCam.Update;
//load the image into ievMain to show it larger
if (not sckbCamLoad.Checked) then begin
ievMain.IO.WIAParams.ProcessingBitmap := ievMain.IEBitmap;
//scbCamTransferFormat2 is a Combobox
case scbCamTransferformat2.ItemIndex of
0: ievMain.IO.WIAParams.TransferFormat := ietfDefault;
1: ievMain.IO.WIAParams.TransferFormat := ietfBitmap;
2: ievMain.IO.WIAParams.TransferFormat := ietfJpeg;
3: begin
ievMain.IO.WIAParams.TransferFormat := ietfRawBitmap;
//OK but to small: ievMain.IO.WiaParams.GetItemThumbnail( TIEWiaItem(Node.Data), ievMain.IEBitmap );
//NOT OK: ievMain.IO.WIAParams.Transfer( TIEWiaItem(Node.Data) , false);
end;
end;
//this dosn't work on cr2-files with all four transfer formats
ievMain.IO.WIAParams.Transfer( TIEWiaItem(Node.Data) , false);
ievMain.Update;
if ievMain.IO.Params.EXIF_HasEXIFData then begin
// fill EXIF samples frame
with ievMain.IO.Params do begin
slblCamExif1Value.Caption := String(EXIF_Make);
slblCamExif2Value.Caption := String(EXIF_Model);
slblCamExif3Value.Caption := String(EXIF_DateTime);
slblCamExif4Value.Caption := IntToStr(EXIF_ExifImageWidth)+' x '+IntToStr(EXIF_ExifImageHeight);
end;
end
else begin
//clear the labels here
end;
end;
end;
What is wrong?
2. If I clicked firstly on a jpg-file and than on a cr2-file in the Exif informations I will get the informations for the last clicked jpg-file. How can I "clear" the IO.Params-Informations? I think it's so because of ievMain has no image loaded. But otherwise ievMain.IEBitmap.IsEmpty is false! And ievMain.IO.Params.EXIF_HasEXIFData is True.
3. How can I transfer a cr2-file from the memory card to a hard disk? It works also with jpeg only: Filling SaveTransferBufferAs with the file destination. It works with cr2 files only in the following constellation: Transferformat = ietfJpeg, Default extension = .cr2: Then I will get a file with .jpg as extension which is a tif file (says IrfanView). If I rename the extension into tif I can open it. Normally it is necessary to copy the file from the memory card to the hard disk with the correct extension only. But there is only a pointer to the node.data.
Thank you for any suggestions.
Jens |
|
xequte
38684 Posts |
Posted - Feb 17 2016 : 22:29:55
|
Hi Jens
Camera RAW files require ielib for loading. Have you added ielib32.dll to the same folder as your EXE file?
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
jenswahl
Germany
71 Posts |
Posted - Feb 18 2016 : 01:05:39
|
Hello Nigel,
in the Helpfile I found this:
To use for these formats ielib32.dll you will need to edit ie.inc and enable the following defines: IEUSEDLLJPEGLIB IEUSEDLLPNGLIB IEUSEDLLJPEG2000LIB You then need to recompile your packages.
Problem: I have bought the precompiled version. Was this already done (it's included)?
Jens |
|
|
jenswahl
Germany
71 Posts |
Posted - Feb 18 2016 : 01:17:13
|
Hello Nigel,
another one:
To initialize the library it's necessary to call IELibAvailable (see Help file). But IELibAvailable is included in IEVision which I haven't bought. The "normal" program with and without the ielib32.dll in it's folder displays camera raw files form the hard disk. How can I initialize the library without IELibAvailable?
Jens |
|
|
jenswahl
Germany
71 Posts |
Posted - Feb 18 2016 : 01:24:33
|
Hello Nigel,
I found a dcu "ievision" and included it. Now IELibAvailable give back True. So I think that the precompiled version includes the ielib32.dll. The test with the dll in the folder and the camera I will start today in the evening. I will report about the result.
Thank you.
Jens |
|
|
klausdoege
Germany
389 Posts |
Posted - Feb 18 2016 : 04:20:25
|
Hallo Jens, Nigel hat recht, mit ielib32.dll klappt alles. Ich habe einen RAW-Konverter geschrieben der läuft tadellos.
Klaus www.klausdoege.de |
|
|
xequte
38684 Posts |
Posted - Feb 18 2016 : 13:41:59
|
Hi Jens
You should not need to recompile or call anything to add RAW support to ImageEn, you only need to put the ielib32.dll in the same folder as your EXE.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
jenswahl
Germany
71 Posts |
Posted - Feb 19 2016 : 01:23:34
|
Hello Nigel,
I tried it with the ielib32.dll in the application's path: the same result. If I rename the dll and start the program IELibAvailable gives also back True: I think because of the same dll in the windows subfolders syswow64 and system32.
I believe that we have to divide the problem into two cases: 1. Displaying a raw image file from the disk works fine without a problem (I copied it using Canon's "CameraWindow" from the memory card onto a HDD). 2. Displaying a raw image from a connected camera is my problem!
I tried it again with the CameraGetImages-Demo: I replaced all places with .Transferformat := ietfJpeg to ietfRawbitmap and later with ietfBitmap. On running the demo I selected the "Load Image" and "Save to disk" checkboxes. No problem with images which were saved as Jpeg file on the memory card of the camera. But also your demo didn't display a cr2-file in the ImageEnView1. The GetItemThumbnail in ImageEnView2 works fine!
@Klaus: I tried your CameraRaw.exe and I saw that you read only files from a disk; not from a connected camera. And the last one is my problem!
Jens |
|
|
nwscomps
185 Posts |
Posted - Feb 26 2016 : 07:36:18
|
Hi Jens, as far as I know WIA transfer in imageEn does not support raw files.
Francesco Savastano Nwscomps.com Add-ons for the ImageEn Library |
|
|
jenswahl
Germany
71 Posts |
Posted - Feb 26 2016 : 07:48:39
|
Hello nwscomps,
what a pity! However thank you for the information.
Jens |
|
|
xequte
38684 Posts |
|
jenswahl
Germany
71 Posts |
Posted - Feb 29 2016 : 00:58:42
|
Thank you, than I will vote for it...
Jens |
|
|
nwscomps
185 Posts |
Posted - Jun 11 2016 : 09:51:30
|
*TOPIC EDITED* I found out that the solution below just works for AVI files. I am investigating how to save the pointer of the data to file for other formats. --------------------------------------------------------------------
I have made a small change to iewia.pas to allow transfer of any file directly to a file location (but not to memory bitmap). This should allow to transfer raw files as well. Then you can open them after they have been transferred.
the changes are posted below:
//Francesco Savastano: added custom format
TIETransferFormat = (ietfDefault, ietfBitmap, ietfJpeg, ietfRawBitmap, ietfCustom);
// TIETransferFormat = (ietfDefault, ietfBitmap, ietfJpeg, ietfRawBitmap);
and in the getpage procedure:
if fSaveTransferBufferAs <> '' then
begin
case fTransferFormat of
ietfDefault, ietfRawBitmap: ext := '.raw';
ietfBitmap: ext := '.bmp';
ietfJpeg: ext := '.jpg';
//Francesco Savastano: added custom saving
ietfCustom: ext := extractfileext(fSaveTransferBufferAs);
end;
iemem.SaveToFile(ChangeFileExt(fSaveTransferBufferAs, ext));
end;
Francesco Savastano Nwscomps.com Add-ons for the ImageEn Library |
|
|
nwscomps
185 Posts |
Posted - Jun 11 2016 : 11:12:18
|
My last solution:
//Francesco Savastano: added custom format
TIETransferFormat = (ietfDefault, ietfBitmap, ietfJpeg, ietfRawBitmap, ietfCustom);
// TIETransferFormat = (ietfDefault, ietfBitmap, ietfJpeg, ietfRawBitmap);
In the TIEWIA.Transfer procedure apply following changes:
case fTransferFormat of
ietfBitmap:
SetItemPropertyEx(WIA_IPA_FORMAT, IEConvertGUIDToString(@WiaImgFmt_MEMORYBMP), witem);
ietfJpeg:
SetItemPropertyEx(WIA_IPA_FORMAT, IEConvertGUIDToString(@WiaImgFmt_JPEG), witem);
//francesco savastano
ietfCustom:
SetItemPropertyEx(WIA_IPA_FORMAT, IEConvertGUIDToString(@WiaImgFmt_UNDEFINED), witem);
else
SetItemPropertyEx(WIA_IPA_FORMAT, IEConvertGUIDToString(@WiaImgFmt_MEMORYBMP), witem);
end;
In the TIEWIA.GetPage add the following:
var
mems:TMemorystream; //define a memory stream object
//Francesco Savastano Start
if (fTransferFormat = ietfCustom) and (fSaveTransferBufferAs = '') then
begin
raise Exception.Create('No Destination File defined for Custom format');
end;
if (fTransferFormat = ietfCustom) then
begin
//here we load the all data inside the memory stream as it is
mems := TMemoryStream.Create;
try
mems.SetSize(datalen);
mems.seek(0,0);
mems.WriteBuffer(data^, datalen);
//then save it to file
mems.SaveToFile(fSaveTransferBufferAs);
//I tested this for a jpeg and for a AVI
//it worked perfectly saved also all the exif information of jpeg
// it *should* work for any file CR2 or any format, even pdf
//but needs testing
result := true;
finally
mems.free;
end;
Exit;
end;
//Francesco Savastano End
Francesco Savastano Nwscomps.com Add-ons for the ImageEn Library |
|
|
xequte
38684 Posts |
Posted - Jun 12 2016 : 19:40:29
|
Thanks Francesco
I'd like to investigate implementing this into the main source. For completeness, please email me your iewia.pas file.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
nwscomps
185 Posts |
Posted - Jun 13 2016 : 07:16:09
|
Hi Nigel, thanks. I have also a few other changes in the iewia, not related to this issue, that I made. I will email you shortly.
Francesco Savastano Nwscomps.com Add-ons for the ImageEn Library |
|
|
|
Topic |
|