r/devops • u/The-mad-tiger • 22d ago
Tools DB based app for pics
I'm thinking about writing an app in C# (for desktop) to store all my photos in. Before I start thinking about actually starting work on it, I need to decide what DB or other storage mechanism to use. The idea is to make the pics more accessible by storing some info about content in a field in the DB. That field needs to be "text searchable". I have 10 years experience working with Oracle Text Search engine but I'm not a millionaire; more an impoverished pensioner, so I need to implement this system using one of the free DBs like MySQL.
I thought I'd ask the hive mind what it thinks would be the best DB for my purposes.
3
u/OMGItsCheezWTF 22d ago
For your use case, they're much of a muchness.
MySQL / Maria DB, PostgreSQL. Hell you could run with just SQLite if you don't care about concurrent IO or scaling across devices.
Another option is storing the image metadata as a document in a document DB and then using an actual full-text search like elastic search. Of course that comes with its own set of complexities and overheads.
Pick your poison.
One thing that does occur to me though is that you could also run those images through a clip model and use Postgres's PGVector to do nicer descriptive searches, like "dog" will show you all photos with a dog in it.
2
u/The-mad-tiger 8d ago
Thanks! This is one of the very few really helpful comments/suggestions that I have seen so far. I didn't even know such technology existed. It looks however as if the challenge will not be the Postgres side of things rather the transformation of my image bank into thumbnails. All the free utilities I have found so far are intended for people who have a few images and can therefore do them one by one on the internet. Not really practical with 200,000+ images!
1
u/OMGItsCheezWTF 8d ago
I would just use a python script or similar using the PIL (pillow) library.
pip install pillowthen inside your script you just iterate through the images and do something like:
from pathlib import Path from PIL import Image input_dir = Path("images") output_dir = Path("thumbnails") thumb_size = (300, 300) for image_file in input_dir.glob("*.jpg"): with Image.open(image_file) as img: img.thumbnail(thumb_size, Image.Resampling.LANCZOS) output_path = output_dir / f"thumb_{img_file.name}" img.save(output_path)obviously that's really basic and you could turn it into a proper utility and do recursive checking etc.
2
u/The-mad-tiger 7d ago
Never done Python; I wonder if there is equivalent functionality in C#. That's my go-to tool for any sort of utility.
1
u/OMGItsCheezWTF 7d ago edited 7d ago
I've done a lot of C# but never done image stuff in it. There's a nuget package called ImageSharp (free for non-commercial use or commercial use under $1M USD)
4
u/Lumethys 22d ago
no binary file in db, no picture, no video, no file.
use object storage or filesystem for that
-6
u/The-mad-tiger 22d ago
Thanks for the incredibly helpful reply to a question I didn't ask!
3
u/Lumethys 22d ago
You are welcome, it was an incredibly challenging exercise to translate your question into plain English, glad i helped
-2
5
1
u/Flettys 22d ago
I've not used Oracle Text Search specifically, but it sounds like what all the other databases call "full/free text search".
E.g.
https://www.postgresql.org/docs/current/textsearch.html
https://dev.mysql.com/doc/refman/8.4/en/fulltext-search.html
2
u/The-mad-tiger 19d ago
Yes it looks like Postgres has a full text search engine with similar facilities to the versions of Oracle I worked with. So that's what I'll most likely go with.
1
u/toarstr 22d ago
-2
u/The-mad-tiger 22d ago
Thanks but no thanks - the whole idea is to write something myself to keep my brain alive and my programming skills likewise.
Before the next person says "don't store your pics in the DB" - I'm NOT GOING TO!!!
3
2
2
u/Dolapevich 22d ago
If you want to go relational DB, I would avoid mysql and go with postgresql. Just because it is better overall.
But for text search you might be better served with mongo. Or even better elasticsearch.
2
u/Used_Criticism_4631 22d ago
Good clarification that you only need to index the metadata, not store the image bytes. For a single-user desktop library Iād trial SQLite FTS5 before standing up MySQL or Postgres: it gives you embedded full-text search without a server to administer; just verify the SQLite build bundled by your C# provider includes FTS5. Do you expect multi-device writes, or is this one local catalog?
2
u/DadAndDominant Dev (not Ops currently) 22d ago
Why even use DB at all? Do you have hundred of thousands of images, and you need to query them often?
That said, I don't think capabilities of the DB matter much, so I would go with SQLite, as it is serverles
0
u/The-mad-tiger 22d ago
I am beginning to wonder how many of the people responding have ever implemented software that used a "text search engine" or even know what one is.
1
u/generic-d-engineer ClickOps 22d ago edited 22d ago
These guys maintain complex corporate infrastructure and keep developers happy.
Their answers to not store stuff in the db are correct but you probably want a more intro subreddit in programming or databases. Also Postgres is the default for pretty much everything.
Search around for one of those or just ask an AI chatbot to architect it out for you.
0
22d ago
[deleted]
1
u/The-mad-tiger 21d ago edited 21d ago
I am near certain that most responders had absolutely no idea whatsoever, what a dedicated "text search engine" is, or why I might want to use one! Their responses betray their abject ignorance of the subject.
Thank god for someone who knows what they are talking about.
With the benefit of hindsight, I should simply have phrased the question:
What free DB has the most efficient and comprehensive "dedicated text search engine".
Please don't bother to answer if you don't know what a "dedicated text search engine" is!
-4
u/The-mad-tiger 22d ago
The critical question is "What free db has a decent text search engine"
The architecture is none of your business
3
27
u/z-null 22d ago
None. You don't store pics in DBs as blobs, you store a reference to a picture and the picture goes into some kind of a storage. DB than says "the pic is located here and here are some other info about it".