[Shotwell] Exposure exif value with 6 zeros

Kaj-Ivar van der Wijst kaj-ivar at vanderwijst.com
Thu Dec 17 13:31:36 UTC 2009


Hi!

I just installed and compiled Shotwell 0.4, which is absolutely great! 
It is improving really quickly.

By using it, I found that the value of the exif exposure is followed by 
six zeros if the value is greater than 1 second. I think this is due to 
the printf function with a double var, that, when it is used without any 
precision-attribute, uses a precision of 6 by default. Line 761 in 
'Exif.c' is where this happens, with

result = g_strdup_printf ("%f s", exif_rational_to_double (exposure));

If this could be changed in

result = g_strdup_printf ("%.1f s", exif_rational_to_double (exposure));

there would be a precision of 1 by default, which would be enough (as 
exposures are always 1,3 - 1,6 - 2 - 2,5 s ...). The only problem with 
this is that an exposure of 13" for example, would be shown as '13,0 s'. 
This can be helped with a simple if-statement, like this:

if (exif_rational_to_double (exposure) * 10 - (int) 
exif_rational_to_double (exposure) * 10 == 0) {         // Checks if 
exposure is int or float
    result = g_strdup_printf ("%.0f s", exif_rational_to_double 
(exposure));                                               // Precision 
of 0, like '15 s' and not '15,0 s' or '15,000000 s'
}
else {
    result = g_strdup_printf ("%.1f s", exif_rational_to_double 
(exposure));                                               // Precision 
of 1, like '2,5 s'
}

I know, it is very elegant, but it does the job (at least on my 
computer, I haven't tested it anywhere else).


I hope this will be of some help for someone, I don't know who or how, 
as this is my very first attempt to improve opensource software. My 
programming skills are very bad, like my English, so please forgive me 
(and correct me! ;) ) if you like. I also don't know if this is the 
right place to post it.

Again, thank you all for the great work by making such great software.

Kaj-Ivar

-- 

Kaj-Ivar van der Wijst
kaj-ivar at vanderwijst.com
http://design.vanderwijst.com
http://www.flickr.com/photos/kaj-ivar/
Linux user #481234
Be Free: Use Linux




More information about the Shotwell-list mailing list