Why not a database for images?


#1

@cstewart Before stumbling upon this book, I had built an app to track inventory, which also stores product images as BLOB data type on a SQLite database. Just like the images used in CriminalIntent app, my app also used images snapped by the camera app, implying high-quality .jpeg images. When using the app I hadn’t noticed any significant latency issue with fetching the images from the database even though I had to read and decode byte stream.

So, could you please explain what you mean by:

Full-size pictures are too large to stick inside a SQLite database, much less an Intent

Further, can you explain in detail (if possible, empirically) why it’s a bad idea to store images inside a database? Thanks :+1:


#2

The story with this is no different on Android than any other platform. I would store images on the file system rather than in a database. Since images are so large, it’s going to increase the load on the database as you are querying/inserting/updating data in that database.

You can find more in-depth info in articles that people have written. For example: https://www.quora.com/What-is-the-best-approach-to-store-image-into-SQLite