Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix of the Flash description for Flash == OFF #356

Merged
merged 1 commit into from
Oct 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Source/com/drew/metadata/exif/ExifDescriptorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,8 @@ public String getFlashDescription()
sb.append(", return not detected");
}

if ((value & 0x10) != 0)
// If 0x10 is set and the lowest byte is not zero - then flash is Auto
if ((value & 0x10) != 0 && (value & 0x0F) != 0)
sb.append(", auto");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a reference for this change? (On phone right now.)

Copy link
Author

@Gorbush Gorbush Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference is here:
Hi,

sorry missed this email.
By reference did you mean why I think this change is right?

Here is the clarification:
com/drew/metadata/exif/ExifDirectoryBase.java:333
Basing on the description of this field

/**
 * 0x0  = 0000000 = No Flash
 * 0x1  = 0000001 = Fired
 * 0x5  = 0000101 = Fired, Return not detected
 * 0x7  = 0000111 = Fired, Return detected
 * 0x9  = 0001001 = On
 * 0xd  = 0001101 = On, Return not detected
 * 0xf  = 0001111 = On, Return detected
 * 0x10 = 0010000 = Off
 * 0x18 = 0011000 = Auto, Did not fire
 * 0x19 = 0011001 = Auto, Fired
 * 0x1d = 0011101 = Auto, Fired, Return not detected
 * 0x1f = 0011111 = Auto, Fired, Return detected
 * 0x20 = 0100000 = No flash function
 * 0x41 = 1000001 = Fired, Red-eye reduction
 * 0x45 = 1000101 = Fired, Red-eye reduction, Return not detected
 * 0x47 = 1000111 = Fired, Red-eye reduction, Return detected
 * 0x49 = 1001001 = On, Red-eye reduction
 * 0x4d = 1001101 = On, Red-eye reduction, Return not detected
 * 0x4f = 1001111 = On, Red-eye reduction, Return detected
 * 0x59 = 1011001 = Auto, Fired, Red-eye reduction
 * 0x5d = 1011101 = Auto, Fired, Red-eye reduction, Return not detected
 * 0x5f = 1011111 = Auto, Fired, Red-eye reduction, Return detected
 *        6543210 (positions)
 *
 * This is a bitmask.
 * 0 = flash fired
 * 1 = return detected
 * 2 = return able to be detected
 * 3 = unknown
 * 4 = auto used
 * 5 = unknown
 * 6 = red eye reduction used
 */

Auto is everywhere where bit is set 0x10 but requires that the lower 4 bits
are not zero:

 * 0x10 = 0010000 = Off

 * 0x18 = 0011000 = Auto, Did not fire
 * 0x19 = 0011001 = Auto, Fired
 * 0x1d = 0011101 = Auto, Fired, Return not detected
 * 0x1f = 0011111 = Auto, Fired, Return detected

 * 0x59 = 1011001 = Auto, Fired, Red-eye reduction
 * 0x5d = 1011101 = Auto, Fired, Red-eye reduction, Return not detected
 * 0x5f = 1011111 = Auto, Fired, Red-eye reduction, Return detected

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up. This looks great.


if ((value & 0x40) != 0)
Expand Down