Filtering Files with long exposure times by script

Post Reply
Ulrich
Posts: 30
Joined: 14 Jul 21 11:59

Filtering Files with long exposure times by script

Post by Ulrich »

Hi there,
I'm shooting often with natural density filters and long exposure times.
There is a little extra workflow step for these files, why I implemented a little mark in the thumbnail info that shows the exposure time for all files with more than 1 second exposure.
See the code below.

My question: Is it possible to use this - or a similar - code to filter for these files instead of 'only' use an indicator?

Greetings,
Ulrich

Code: Select all

%code
var
....	
cExposureTime: Widestring;

begin
....

cExposureTime := '%xmp:exif:ExposureTime'
if (cExposureTime <> '') then
begin
	if (LeftStr(cExposureTime,2) <> '1/') then
	begin
		result := result + '<font bgcolor="#FF008888" color="#000000" bgradius="0.3">&nbsp;' + cExposureTime + '&nbsp;</font>&nbsp;';
	end;
end;

end;
%/code
Ulrich
Posts: 30
Joined: 14 Jul 21 11:59

Re: Filtering Files with long exposure times by script

Post by Ulrich »

Additional Question:
For 'original' RAW Files, %xmp:exif:ExposureTime seems to be allways available.
For my converted Adobe-DNG Files, this variable is allways empty.
Does anyboady know if there is any other variable which I could use for DNG's to read the exposure time?
btw. aperture and iso are also empty for DNG's.

Ulrich
Ulrich
Posts: 30
Joined: 14 Jul 21 11:59

Re: Filtering Files with long exposure times by script

Post by Ulrich »

So,
meanwhile I tried to code this script adopting another filter script from Hert.
Unfortunately, I didn't get it!
Does anyboady knows what might be wrong?

Code: Select all

function Initialize: Boolean;
begin
     Screen.Cursor := crHourglass;
     result:= true;
end;	

procedure Finalize;
begin
	Screen.Cursor := crDefault;
end;

function Filter(AItem: TImageItem): Boolean;
begin
	if ('%xmp:exif:ExposureTime' <> '') then
	begin
		if (LeftStr('%xmp:exif:ExposureTime',2) <> '1/') then
		begin
			result := true;
		end;
	end;
end;
Hert
Posts: 7911
Joined: 13 Sep 03 6:24

Re: Filtering Files with long exposure times by script

Post by Hert »

If the metadata is in Exif but not XMP then use Convert Metadata to XMP to get such values from the Exif for the DNG. If these values are then still not there then it’s not in the DNG.

PS. I don’t understand why one would mirror their original RAW files as yet another RAW file, this time a DNG. It’s more of the same. Do you really need a DNG?
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Ulrich
Posts: 30
Joined: 14 Jul 21 11:59

Re: Filtering Files with long exposure times by script

Post by Ulrich »

Hello Hert,
thank you for your explanation with the DNG's.

To explain: No, I don't need both for one photo.
I converted Nikon-NEF files to DNG's up to a year ago and deleted the NEF's.
Today I use Fuji-RAF files (without DNG's).

Nevertheless, I would like to be able to use the 'old' DNG's as well as the current RAF's with PSU.
May I also ask if you can help with the filter script?
Why does not it work? What am I doing wrong?

Ulrich
Hert
Posts: 7911
Joined: 13 Sep 03 6:24

Re: Filtering Files with long exposure times by script

Post by Hert »

Maybe because the Filter method doesn't have a return value when the if statements don't both resolve to true?
Try to start the Filter method with result := false;
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Ulrich
Posts: 30
Joined: 14 Jul 21 11:59

Re: Filtering Files with long exposure times by script

Post by Ulrich »

Hi,
I found my mistake, but I have no clue what the correct syntax is.

Code: Select all

if (LeftStr('%xmp:exif:ExposureTime',2) <> '1/') then
This if-clause returns always the string %xmp:exif:ExposureTime (left(...),2) --> %x because I placed quotation marks around.
So the if-clause never could get true.

What is the correct syntax to retrieve the Exposure Time in a script ??
When I delete the quotation marks it ends up in an PSU Error Message.

Any clue for me?
Greetings
Ulrich
Hert
Posts: 7911
Joined: 13 Sep 03 6:24

Re: Filtering Files with long exposure times by script

Post by Hert »

Ah, but that makes sense.

This is a filter script, and so the script runs for every image in the set. PSU will not parse macros in the script because then that script won't be valid for the next image.

You'll have to parse the macro for the image that the filter script runs for.

Code: Select all

AExp := AItem.ParseMacros('%xmp:exif:ExposureTime', nil);
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Post Reply