Skip to content

Commit 8a2d56d

Browse files
authored
Merge pull request #445 from drewnoakes/round-shutter-speed-value
Fix shutter speed description calculation
2 parents 6d79ebd + 8a62769 commit 8a2d56d

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

MetadataExtractor/TagDescriptor.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,6 @@ public TagDescriptor(T directory)
289289

290290
protected string? GetShutterSpeedDescription(int tagId)
291291
{
292-
// I believe this method to now be stable, but am leaving some alternative snippets of
293-
// code in here, to assist anyone who's looking into this (given that I don't have a public CVS).
294-
// float apexValue = _directory.getFloat(ExifSubIFDDirectory.TAG_SHUTTER_SPEED);
295-
// int apexPower = (int)Math.pow(2.0, apexValue);
296-
// return "1/" + apexPower + " sec";
297-
// TODO test this method
298-
// thanks to Mark Edwards for spotting and patching a bug in the calculation of this
299-
// description (spotted bug using a Canon EOS 300D)
300-
// thanks also to Gli Blr for spotting this bug
301292
if (!Directory.TryGetSingle(tagId, out float apexValue))
302293
return null;
303294

@@ -310,7 +301,7 @@ public TagDescriptor(T directory)
310301
}
311302
else
312303
{
313-
var apexPower = (int)Math.Exp(apexValue * Math.Log(2));
304+
var apexPower = (int)Math.Round(Math.Exp(apexValue * Math.Log(2)));
314305
return "1/" + apexPower + " sec";
315306
}
316307
}

0 commit comments

Comments
 (0)