[Digikam-users] File weight different in Digikam than in other file management tools

Jean-François Rabasse jf at e-artefact.eu
Tue Jan 21 13:17:00 GMT 2014


Hello,


On Tue, 21 Jan 2014, Marie-Noëlle Augendre wrote:

> I understand why it 'could' be different.
> But the question remain: why two different file managing tools (in that
> case Digikam and Nautilus) don't apply the same rule on the same system? I
> don't find this very user-friendly. :-)

Well, different tools don't apply the same rule because there's no
official common rule:-)
As Jürgen Blumenschein explained, these are two cultures.
In the common human culture, multiplier prefixes kilo, mega, etc., are 1000, 
1000000, etc. because we, humans, use a base 10 numeral system.
In the computers world culture, base 2 numeral system, people often
translate quantities to the nearest power of 2 value.
Thus 1000 becomes 1024.
Noone is right or wrong, it's only two different conventions and
applications developers choose. Some will prefer to stay in computers
culture, some other will prefer to stick to the common culture.


However, in case you need accurate control on your files sizes, none
of these display conventions can be reliable and you should forget GUI
based tools that only give coarse approximations of files sizes.
(And also rounded values.)

Use accurate command line tools, e.g. the ls command :
   ls -l DSCH3953.JPG
   ..... 5668148 Dec 21 08:19 DSCH3953.JPG
this file size is 5,668,148 bytes, no more, no less.

And, of course, avoid « human readable » flags :
   ls -lh DSCH3953.JPG
   .....  5.5M Dec 21 08:19 DSCH3953.JPG
or you'll get back into the same confusion.

The use case you evoqued, uploading files to a web service that fixes
an upper size limit, is common. Contests registrations, yes, and also
online photo print services that limit uploads.

The problem is that you won't always know if the required limit is
based on 1000 or 1024 for a kilo.
If your site says « Max is 300 K », it could be 300000 bytes
or 307200  bytes, depending on the convention used.

But this doesn't matter.
Build you file using the smallest value, here 300000. That way, you'll
be sure your upload won't be rejected, and for your image it will change
nothing.
(Typically for a 1024 pixels JPEG, you'll have to tweak quality around
87%, 90%, values.
If with, e.g. 88% quality, you get a file size of 301000 bytes, go done
to 87% quality, you'll get something around 290000 bytes and the two
images will be visually identical. With a difference of 1%, you won't
be able, with an images viewer, to guess which one is which one.)

Regards,
Jean-François


More information about the Digikam-users mailing list