Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image database
#1
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
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#2
Others may disagree, but imho, you should not store image files in a database; rather store a symbolic link to said image file.
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply
#3
(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
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#4
(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.
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020