Python Forum

Full Version: Image database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I have inherited a situation where many thousands of scanned images reside as individual .tif files in a directory.
Not a problem, because I can retrieve them programmatically, effectively in a "random access" mode.
Except, they take up a huge amount of terabytes , even compressed as they are.

I've been reading up on how to store images in a (kind of) database, and as usual it's all very inconclusive.
Some say "use BLOB", others say "never use Blob for images", ....? I've tried numpy/plt...
My question is:
If the only goal is less storage space, what db-like object or technique, should I be using? If any !
A small loss of quality is acceptable, as long as texts remain readable when extracted from the db.
thx,
Paul
Others may disagree, but imho, you should not store image files in a database; rather store a symbolic link to said image file.
(Oct-11-2022, 07:17 AM)rob101 Wrote: [ -> ]Others may disagree, but imho, you should not store image files in a database; rather store a symbolic link to said image file.
Fair enough, it's extra work anyway.
I've been experimenting with jpg and png.

Years ago TIF was chosen because of lossless compression, and future compatibility.
If i convert to jpg or png, using PIL, I could save at least 50% storage space.
Any opinion on that ?
Thanks,
Paul
(Oct-11-2022, 08:04 AM)DPaul Wrote: [ -> ]Years ago TIF was chosen because of lossless compression, and future compatibility.
If i convert to jpg or png, using PIL, I could save at least 50% storage space.
Any opinion on that ?
Thanks,
Paul

You're very welcome.

My opinion about image database storage would not change. Aside from the database overhead, it's also a disk space double usage, as you'll have the image file on disk as well as in the database. That said, disk space is now way less of an issue than once was, but even so, why be wasteful.

As for the image file itself, it depends on what the files are being used for and if you need to convert them to save on disk storage space or bandwidth, if said files are going back and forth over a computer network. If neither is an issue, then I'll leave them as TIFF files.