T O P I C R E V I E W |
jrpcguru |
Posted - Jul 02 2018 : 19:22:28 I have just updated to Delphi 10.2 and before I started using it, updated to ImageEn 8.x too. One of my programs uses ImageEn to extract the EXIF date/time to be used while renaming files. I shortly discovered that the program no longer renamed files when asked to include the EXIF date/time. My Delphi XE2 version did the same thing.
For a long time I have used ImageEnView1.IO.ParamsFromFile(sPath + sName); //first try loading just parameters, no image for speed
to obtain the EXIF data during file renaming operations. It no longer loads the EXIF. This syntax is still described in the help file. I also tried an alternate syntax which also failed. I did find a work around which involves loading the entire image via ImageEnView1.IO.LoadFromFile. Here is a cleaned up version of my code:
procedure subLoadImageEnMetaDataOnly;
begin
//ResetInfo is done before calling this code to clear all Exif
bImageEnSucceeded := true;
ImageEnView1.Visible := false; //don't show - all we are doing is reading Exif
//use ImageEn to read Exif
if SysUtils.FileExists(sPath + sName) then
begin
ImageEnView1.IO.ParamsFromFile(sPath + sName); //first try loading just parameters, no image for speed
ImageEnView1.IO.ParamsFromFile(sPath + sName, ioUnknown); //first try loading just parameters, no image for speed
//both of the above options fail
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
ImageEnView1.IO.Params.JPEG_Scale := ioJPEG_EIGHTH; //high speed load
ImageEnView1.IO.LoadFromFileAuto(sPath + sName); //try to load by analyzing content, not extension
end;
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
showmessage('ParamsFromFile and LoadFromFileAuto failed');
ImageEnView1.IO.LoadFromFile(sPath + sName);
//prevent flashing of image during renaming
ImageEnView1.blank;
end;
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
ImageEnView1.Clear;
ImageEnView1.blank;
bImageEnSucceeded := false; //still couldn't read image file
end;
end;
end;
J.R. |
12 L A T E S T R E P L I E S (Newest First) |
Uwe |
Posted - Aug 01 2018 : 18:35:45 Most CRW images do not contain Exif
Most of the information is stored in a sidecar file with the extension *.THM. You'll have to parse this file to get at the tags.
-Uwe |
xequte |
Posted - Aug 01 2018 : 16:04:03 Hi JR
Here is the result of the investigation...
Most CRW images do not contain Exif, but a proprietary format. ImageEn does decode some CRW tags and return them as "Exif", including EXIF_DateTime, EXIF_ISOSpeedRatings, EXIF_FocalLength, EXIF maker and modelname, etc. But EXIF most tags are not supported.
In our testing we could not find a file that was supported in an older version of ImageEn, but not the latest one.
Nigel Xequte Software www.imageen.com
|
xequte |
Posted - Jul 16 2018 : 21:21:16 Hi JR
Thanks, I can reproduce the lack of EXIF in some Canon images. We will investigate for 8.0.2
Nigel Xequte Software www.imageen.com
|
jrpcguru |
Posted - Jul 13 2018 : 10:45:46 Further update: using https://www.get-metadata.com/result/f359f346-6054-49a2-bfe7-7f5f83c6e0f8
It does read EXIF from your sample .CRW file and from my one file that ImageEn reads. I did a quick test of other files that ImageEn couldn't read and it was successful.
J.R. |
jrpcguru |
Posted - Jul 13 2018 : 10:40:38 I have just tried to do an inventory of all the .CRW files in my possession. I found only one that would display full EXIF with ImageEn.
I then tried reading the EXIF with http://metapicz.com/#landing It successfully read the EXIF for the one file that worked. It agrees with ImageEn on a representative sampling of my remaining files, including your demo file: Canon_Generic_Raw.CRW that they have no EXIF. So apparently I have a lousy sample to test with! My apologies.
However, during my testing, I came across another oddity. The code you helped with above turned out like this:
if SysUtils.FileExists(sPath + sName) then
begin
success := ImageEnView1.IO.ParamsFromFile(sPath + sName, true); // Use file extension
if not success then
begin
ImageEnView1.IO.ParamsFromFile(sPath + sName, False); // Analyze content
end;
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
ImageEnView1.IO.Params.JPEG_Scale := ioJPEG_EIGHTH; //high speed load
ImageEnView1.IO.LoadFromFileAuto(sPath + sName); //try to load by analyzing content, not extension
//prevent flashing of image during renaming
ImageEnView1.blank; //set to 1x1 bits to allow IsEmpty to work and free memory
end;
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
ImageEnView1.IO.LoadFromFile(sPath + sName);
//prevent flashing of image during renaming
ImageEnView1.blank; //set to 1x1 bits to allow IsEmpty to work and free memory
end;
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
ImageEnView1.Clear;
ImageEnView1.blank; //set to 1x1 bits to allow IsEmpty to work and free memory
bImageEnSucceeded := false; //still couldn't read image file
end;
end;
end;
When trying to load the ParamsFromFile for a .CRW file, it reports True. But HasEXIFData reports false. In fact it appears to load a small amount of data as I sent to you.
J.R. |
jrpcguru |
Posted - Jul 11 2018 : 20:16:42 Thank you for your quick response in issuing ImageEn 8.0.1. Unfortunately I'm still having problems reading EXIF data from .CRW files. I have installed 8.0.1 and I'm using ielib32.dll, version 4.5.0.0, with a new file date of 7/10/2018. I downloaded sample raw files from: http://www.rawsamples.ch/index.php/en/canon I downloaded every .CRW file, a few .CR2 files and every .DNG file.
At first my photo renaming program still failed to read EXIF from any .CRW though it succeeded with the .CR2 and .DNG files. Then I tried my scanning program and it was able to read partial EXIF from .CRW, not including useful things like exposure information. Both programs use the same command to load an image file, (ImageEnView1.IO.LoadFromFile(inName);) but it turns out that the photo renaming program uses this before attempting to read the EXIF:
if ImageEnview1.IO.Params.EXIF_HasEXIFData = true then
and the .CRW files all report false. If I change this test to false, then the photo renaming program displays almost the same EXIF data as the scanning program. (It turns out I do not use HasEXIFDATA in the scanning program.) The weird thing is that both programs use this exact code to read the X and Y resolution:
sData := sData + 'XResolution = ' + floattostr(EXIF_XResolution) + sLineBreak; sData := sData + 'YResolution = ' + floattostr(EXIF_YResolution) + sLineBreak;
Yet the photo renaming program yields 0 and the scanning program yields 300. The scanning program is in XE2 and the photo renaming program is in 10.2.
This is what the scanning program delivers:
***** File Summary ***** File Name = RAW_CANON_300D.CRW File Size = 8,130K (8,326,016) File Date = 7/11/2018 4:26:20 PM
K:\Delphi XE projects\Sample Files\RAW files\Canon raw\RAW_CANON_300D.CRW ***** End of File Summary *****
Image colors = RGB 24-Bit
Make = Canon Model = Canon EOS 300D DIGITAL Software = Firmware Version 1.1.1 Date Time = 2007:03:03 11:26:42 XResolution = 300 YResolution = 300 ----------------------------------------------- Exif Image Width = 3072 Exif Image Length = 2048 Focal Length = 1.125 mm ISO Speed = 100 MegaPixels = 6.3 ================================================================================================ Note that the Focal Length reported seems quite unlikely. All all exposure data is missing. Otherwise the only difference with the photo renaming program is XResolution and YResolution = 0.
I don't know if any of these .CRW actually has more EXIF data. About half of them respond the same way with my code, the other half report no EXIF even with HasEXIFDATA = false.
So far as I know, other raw file formats are delivering EXIF data correctly.
J.R. |
xequte |
Posted - Jul 03 2018 : 19:25:22 Hi JR
IELib is fine. The bug only affects code that loads images/params without using the file extension. We'll probably release 8.0.1 at the end of next week depending on what other issues pop up. But feel free to email me for the source (Just using the fixed source, without recompiling the packages, will be enough to resolve the issue).
Nigel Xequte Software www.imageen.com
|
jrpcguru |
Posted - Jul 03 2018 : 18:46:11 Thanks. At least I'm not imagining things!
Since I am using ielib32.dll, will it be possible to fix the EXIF vs. .CRW issue with a new DLL or will that require an entire ImageEn update?
J.R. |
xequte |
Posted - Jul 03 2018 : 16:05:27 Hi JR
There is a bug in 8.0.0, where FindFileFormat (which is used by any routines that require ImageEn to analyze the content to guess the file format) returns ioWIC instead of a better format, such as ioJPEG. We'll have a fix for this in 8.0.1 over the next week or two.
You can email me for the updated source code.
Nigel Xequte Software www.imageen.com
|
jrpcguru |
Posted - Jul 03 2018 : 10:58:13 Another interesting detail that I just discovered: With the .CRW files, the following line of code reports success: success := ImageEnView1.IO.ParamsFromFile(sPath + sName, True); // Use file extension but this line finds no EXIF data was actually loaded: if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then if I change the first line to: success := ImageEnView1.IO.ParamsFromFile(sPath + sName, false); // try to load by analyzing content, not extension It still reports success, but does not actually load EXIF
J.R. |
jrpcguru |
Posted - Jul 03 2018 : 10:46:50 Thank you for your prompt reply. To clarify: I provided the two syntaxes of the ParamsFromFile that I had used. I did not intend to imply that I used them simultaneously. They each failed on their own and continue to do so, even though the help file says I used legitimate syntax. Your alternative syntax, which I had not tried, did work correctly. Thank you!
There is one remaining possible flaw however. ImageEn 8.0 is apparently unable to read EXIF from .CRW files. ImageEn 7.5 does read EXIF from all 9 of my sample files. I have a folder labeled "ImageEn Sample Raw Files" which has a zip file called "raw_test_images.zip" so I suspect you provided those files. Several other raw files do not report EXIF data, but 8.0 and 7.5 agree on that matter. All but 1 .CRW files fail with 8.0 and don't fail with 7.5.
I went back to a one year older version of my program. I don't know which version of ImageEn was used, but ielib32 claims version 3.0.8.0. It successfully reads the EXIF from the same 1 of 9 .CRW files. So it would appear that Iebil32.dll version 4.0.0.0 figured out how to read all .CRW file samples, but then this was lost in the latest version of ielib32, version 4.5.
J.R. |
xequte |
Posted - Jul 03 2018 : 00:24:51 Hi JR
You have some unneeded code here.
Your two calls to ParamsFromFile will have the same effect, and second one would clear result of first. Also, if you are only after EXIF data, there is no value in using LoadFromFile.
Your code should be something like:
var
success: Boolean;
begin
ImageEnView1.Visible := false; //don't show - all we are doing is reading Exif
if SysUtils.FileExists(sPath + sName) then
begin
success := ImageEnView1.IO.ParamsFromFile(sPath + sName, True); // Use file extension
if not success then
ImageEnView1.IO.ParamsFromFile(sPath + sName, False); // Analyze content
if ImageEnView1.IO.Params.EXIF_HasEXIFData = false then
begin
showmessage('ParamsFromFile failed');
end
else
begin
showmessage('ParamsFromFile Success');
end;
end;
end;
Which works in my testing.
Nigel Xequte Software www.imageen.com
|