Kphotoalbum ignores the 'Do not read RAW files if a matching JPEG/TIFF file exists' setting

Robert Krawitz rlk at alum.mit.edu
Fri Jan 10 13:40:38 GMT 2025


On 1/10/25 07:42, Andreas Schleth via KPhotoAlbum wrote:
> Hi Andrew,
> 
> I can confirm this behaviour on openSuse Leap 15.6 (KPA 5.13.0). Most probably it is not an OS
> problem but one of KPA itself.
> 
> I tried this:
> a) copy an existing *.jpg to *.RW2, *.dng, *.DNG - KPA imported all 4 and shows them side by side
> b) copy a RW2 file into the same folder as the corresponding *.jpg - KPA does not import or show the
> RW2 (Note: the jpg was imported earlier)
> c) copy a *.jpg and the corresponding *.RW2 into the same folder (new name) - KPA imports both
> 
> My conclusion:
> a) It seems, that KPA does not look into the files to determine the MIME type before import but
> seems to go by file extension.

Just a word of caution about changing this: actually inspecting the files before deciding whether to
import them would dramatically slow down import.  Indeed, even stat()'ing the file is very
expensive, particularly on higher latency media, and a NAS is high latency, even with SSD storage,
due to the network round trip.  Reading a directory is usually pretty fast, since there can be lots
of filenames and inode numbers in one disk block or a sequential set of blocks, but stat() requires
finding the inode on disk and reading it in.  Actually opening files would only increase the
overhead that much more.

The Qt5 directory class always stat()'s every file in the directory so the information would be
available.  I did a lot of performance work on KPA 5 some odd years ago and found this to be a major
bottleneck doing an import into a cold filesystem. I wound up writing a fast directory class that
just returns the list of files in the directory that sped up importing a lot.  Of course, just doing
readdir() means that it doesn't even know whether the entry is a directory or a file, so if a
directory has a name ending in an unknown suffix (as opposed to the more common case of no suffix at
all) it will be skipped.  So a directory named mydir.ods or the like would not get examined, but
that's a small price to pay for much faster import.



More information about the KPhotoAlbum mailing list