Reputation: 3117
I am currently working on an Paint-like WPF application and now stand before the problem how I enable my users to save the created images. Normally I would just save them to disk but in this application I have the requirement to later enable the user to create bigger "images" out of the already created ones. This would still be no problem with a normal filesystem approach but the user should also be able to search images by specific properties like categories/tags etc. and that would be difficult with a normal filesystem approach.
So I thought of some options I have for realizing what I want and now would like to know what you think of the approaches or if you even know a better one. The approaches are:
Thanks!
Upvotes: 5
Views: 1963
Reputation: 137128
It's certainly possible to store the image in a database. You can actually store the image stream as it would be saved to file to save space. When reading out you simply uncompress using the stream reader functionality.
This doesn't have the problems of the other two solutions (coping with deleting files, finding the files by category).
You could save to files using the filesystem by creating folders and subfolders based on your categories, but that doesn't allow you the flexibility of having more than one category per file.
Upvotes: 0
Reputation: 16926
I'd go for the second approach and use the FileSystemWatcher to track changes while the program is running and start a sync during the startup to track changes since the last time the app was run.
SqlLite or SQL Compact Editio are both good choices for a local data base to track the metadata.
Upvotes: 0
Reputation: 5256
You can save files to the filesystem and save or read metadata directly. This feature is also available to the user outside of your application in Windows 7/Vista... I think it's called Image tags. You would have to parse XML.
Good example: http://johndyer.name/post/2006/09/01/Quick-C-Vista-Photo-Tag-Reader.aspx
Upvotes: 1
Reputation: 39833
Many programs (i.e. Aperture, Lightroom, Expression Media to name a few) store their images to disk and then maintain a metadata cache in a database. This seems like the most sensible approach for your application.
Upvotes: 1
Reputation: 15571
SQLITE will be a good choice I feel. Version 3 onward BLOB is fully supported, so you can think of SQLITE.
Upvotes: 1