Incorrect display of numerical exif parameters
Moderators: helmut, XnTriq, xnview
-
- Posts: 19
- Joined: Tue Nov 01, 2005 7:36 pm
Incorrect display of numerical exif parameters
1. Exposure time is always looks like "10/600", but should "1/60" instead (BTW, I have my own function written (in C++), which makes this job.)
2. Focal length is always looks like "50.0000". Why not just "50" ?
3. "F-Number" tag returns something like "F2.8", but should "2.8" instead.
4. The <Size> tag returns size in bytes in the way like "1189701", which is too heavy to read. The string like "1 189 701" would be much better.
2. Focal length is always looks like "50.0000". Why not just "50" ?
3. "F-Number" tag returns something like "F2.8", but should "2.8" instead.
4. The <Size> tag returns size in bytes in the way like "1189701", which is too heavy to read. The string like "1 189 701" would be much better.
Re: Incorrect display of numerical exif parameters
Could you send me a sample with such fields?Alexey Lubkin wrote:1. Exposure time is always looks like "10/600", but should "1/60" instead (BTW, I have my own function written (in C++), which makes this job.)
2. Focal length is always looks like "50.0000". Why not just "50" ?
Ok3. "F-Number" tag returns something like "F2.8", but should "2.8" instead.
Perhaps it would be good to customize size like date??
4. The <Size> tag returns size in bytes in the way like "1189701", which is too heavy to read. The string like "1 189 701" would be much better.
Pierre.
-
- Posts: 19
- Joined: Tue Nov 01, 2005 7:36 pm
Re: Incorrect display of numerical exif parameters
I've sent a sample by the email.xnview wrote:Could you send me a sample with such fields?
I think it's not so important. Everybody probably should accept number formatting like that: "1 234 567".xnview wrote:Perhaps it would be good to customize size like date??
-
- Posts: 19
- Joined: Tue Nov 01, 2005 7:36 pm
Re: Incorrect display of numerical exif parameters
Here is it (MathCancel() - is the function)Alexey Lubkin wrote:1. Exposure time is always looks like "10/600", but should "1/60" instead (BTW, I have my own function written (in C++), which makes this job.)
Code: Select all
#include <stdio.h>
#include <string>
using namespace std;
void MathCancel(int& p, int& q)
{
int pp=p,qq=q;
int tt = pp%qq;
while(tt)
{
pp = qq;
qq = tt;
tt = pp%qq;
}
p = p / qq;
q = q / qq;
}
string inttostr(const int x)
{
char buf[32];
sprintf(buf,"%d",x);
return buf;
}
string GetString(const int p, const int q)
{
string tmp("");
if(q!=1) tmp = "/" + inttostr(q);
return inttostr(p)+tmp;
}
int main()
{
int p=10,q=600;
printf("%d/%d = ",p,q);
MathCancel(p,q);
printf("%s\n",GetString(p,q).c_str());
return 0;
}
Re: Incorrect display of numerical exif parameters
ThanksAlexey Lubkin wrote:Here is it (MathCancel() - is the function)
Very dangerous, must be static char buf[32];Code: Select all
string inttostr(const int x) { char buf[32]; sprintf(buf,"%d",x); return buf; }
Pierre.
Re: Incorrect display of numerical exif parameters
Hmm, but the return type is std::string!xnview wrote:ThanksAlexey Lubkin wrote:Here is it (MathCancel() - is the function)Very dangerous, must be static char buf[32];Code: Select all
string inttostr(const int x) { char buf[32]; sprintf(buf,"%d",x); return buf; }
For clarity I would write "return string(buf);"
Re: Incorrect display of numerical exif parameters
Oh sorry i haven't seen string as return valueVictor Snezhko wrote:Hmm, but the return type is std::string!xnview wrote:ThanksAlexey Lubkin wrote:Here is it (MathCancel() - is the function)Very dangerous, must be static char buf[32];Code: Select all
string inttostr(const int x) { char buf[32]; sprintf(buf,"%d",x); return buf; }
For clarity I would write "return string(buf);"

Pierre.
-
- Posts: 19
- Joined: Tue Nov 01, 2005 7:36 pm
Re: Incorrect display of numerical exif parameters
I've just installed the 1.83 RC3 and found that


is now fixed. Thanks!Alexey Lubkin wrote:1. Exposure time is always looks like "10/600", but should "1/60" instead (BTW, I have my own function written (in C++), which makes this job.)
3. "F-Number" tag returns something like "F2.8", but should "2.8" instead.

And this is still notAlexey Lubkin wrote: 2. Focal length is always looks like "50.0000". Why not just "50" ?
4. The <Size> tag returns size in bytes in the way like "1189701", which is too heavy to read. The string like "1 189 701" would be much better.

-
- Posts: 19
- Joined: Tue Nov 01, 2005 7:36 pm
Here is the code for doing that
And here is the sample output
Code: Select all
#include <iostream>
#include <string>
using namespace std;
string ShowNumber(string s)
{
int i;
bool enough = false;
while( !enough && (s.length()>0) && ((i=s.find_last_of("0. "))==s.length()-1) )
{
enough = s[i]=='.';
s.erase(s.length()-1);
};
return s;
}
string FormatNumber(string s)
{
if(s.length()==0) return string("0");
int i, start = 1+((s.length()+2)%3), count = (s.length()-1)/3;
for(i=0; i<count; i++)
s.insert(4*i+start," ");
return s;
}
int main()
{
string number = "50.0000";
cout << "<" << number << "> = <" << ShowNumber(number) << ">\n";
string filesize = "1234567";
cout << "<" << filesize << "> = <" << FormatNumber(filesize) << ">\n";
return 0;
}
Code: Select all
<50.0000> = <50>
<1234567> = <1 234 567>