Hello Anders
Thanks for your help to write better code ;-) An updated version of the patch is
attached.
I did some more tests with my equipment. These are the results (for both Canon
20D and Canon 1D Mk II) from exiftool:
No flash: 0x9209 - 0x10
Studio light with sync cable: 0x9209 - 0x10
Internal flash (20D): 0x9209 - 0x9
External flash (Canon 580EX): 0x9209 - 0x9
External flash (ST-E2 and Canon 580EX): 0x9209 - 0x9
So this patch seems to be OK for Canon DSLR writing CR2 files. I have no
possibility to test other cameras, but the sould be rather simple to add.
Martin
Am 11/29/2007 12:31 AM schrieb Anders Brander:
> Hi Martin,
>
> On Wed, 2007-11-28 at 19:54 +0100, Martin Egger wrote:
>> here is a small patch to display the status of the Flash in EXIF data. It is
>> a
>> very quick and dirty check for tag 0x9209. For Canon CR2 files, the values
>> are
>> either 0x9 (flash fired) or 0x10 (no flash).
>
> I'm not sure it's that relevant - but let's leave that for now (I have
> been thinking about either a pop-up window when you click the exif-info
> or a tooltip with extended information).
>
> Are you sure it's as simple as that to read? According to
> http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html it's
> more complicated than so, to make matters worse 0x9 is "On" while 0x10
> if "Off" - no info about whether it actually fired.
>
>> As I am not a C programmer, you should probably review it the patch ;-)
>
> I suggest the following:
> - Test some more - auto flash, manual flash, built-in flash, external
> flash etc.
> - Change the type of RS_METADATA::flash to gboolean.
> - Initialize RS_METADATA::flash in rs_metadata_new() to FALSE.
> - Use a switch() to set the value of flash according to the 0x9209 tag.
Index: gtk-interface.c
===================================================================
--- gtk-interface.c (revision 1511)
+++ gtk-interface.c (working copy)
@@ -256,7 +256,9 @@
if (photo->metadata->aperture!=0.0)
g_string_append_printf(label, _("F/%.1f "), photo->metadata->aperture);
if (photo->metadata->iso!=0)
- g_string_append_printf(label, _("ISO%d"), photo->metadata->iso);
+ g_string_append_printf(label, _("ISO%d "), photo->metadata->iso);
+ if (photo->metadata->flash)
+ g_string_append_printf(label, _("Flash"));
gtk_label_set_text(infolabel, label->str);
g_string_free(label, TRUE);
} else
Index: rawstudio.c
===================================================================
--- rawstudio.c (revision 1511)
+++ rawstudio.c (working copy)
@@ -322,6 +322,7 @@
metadata->aperture = -1.0;
metadata->iso = 0;
metadata->shutterspeed = 1.0;
+ metadata->flash = FALSE;
metadata->thumbnail_start = 0;
metadata->thumbnail_length = 0;
metadata->preview_start = 0;
Index: rawstudio.h
===================================================================
--- rawstudio.h (revision 1511)
+++ rawstudio.h (working copy)
@@ -171,6 +172,7 @@
gfloat aperture;
gushort iso;
gfloat shutterspeed;
+ gboolean flash;
guint thumbnail_start;
guint thumbnail_length;
guint preview_start;
Index: tiff-meta.c
===================================================================
--- tiff-meta.c (revision 1511)
+++ tiff-meta.c (working copy)
@@ -527,6 +527,15 @@
if ((float_temp1 < EXPO_TIME_MAXVAL) && (meta->shutterspeed<0.0))
meta->shutterspeed = 1.0/pow(2.0, float_temp1);
break;
+ case 0x9209: /* Flash, tested with Canon .CR2 files */
+ raw_get_ushort(rawfile, offset, &ushort_temp1);
+ switch(ushort_temp1)
+ {
+ case 9:
+ meta->flash = TRUE;
+ break;
+ }
+ break;
case 0x4001: /* white balance for Canon 20D & 350D */
raw_get_uint(rawfile, offset, &uint_temp1);
switch (valuecount)
_______________________________________________
Rawstudio-dev mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-dev