1

I am trying to store bitmaps that come from the device's camera app in SQLite database in the device. I know that storing images as BLOB in a database is not the best approach, however in my case, i cannot avoid it. The problem is that the images can be very large, size since they come from the default camera app of the device and i dont want to decrease noticeably the image quality. Assuming that i cannot avoid to load a bitmap instance of that image in the memmory (or at least the byte array of that image) since i will need it form the insert SQLite query, how can i be sure that i will not have memmory isues (OutOfMemmoryError)? Is there a way of doing this without downscaling (or at least without downscaling the image quality in a noticeable proportion)?

P.S. I have read the android developers section about loading bitmaps efficiently.

Any suggesstion would be appreciated.

Thanks!

AggelosK
  • 4,313
  • 2
  • 32
  • 37
  • What leads you to believe that this is actually a problem? – Tom Kerr Jul 06 '12 at 18:22
  • If you mean the downscaling of the quality of the image, the problem is that my users require the highest possible image quality and to achieve that, in many cases, the image needs to be quite large in size. That can cause memmory handling difficulties. I just want to know if there is an efficient general practice i can follow to achieve storing high quality (probably large) bitmaps as BLOB in a database, since to create the BLOB data of the image, i need to load it in the memmory first. – AggelosK Jul 06 '12 at 20:55
  • @GeorgeSachin I have tried what i mentioned in the question. If you can provide a solution it would be appreciated. Thanks. – AggelosK Jun 25 '13 at 06:12

1 Answers1

2

Even if you manage to store a large image in the DB you won't be able to retrieve it unfortunately. Db cursor size limit.

Community
  • 1
  • 1
bitrock
  • 1,254
  • 1
  • 12
  • 17
  • 1
    Actually this can be done as per [How to use images in Android SQLite that are larger than the limitations of a CursorWindow?](https://stackoverflow.com/questions/55321154/how-to-use-images-in-android-sqlite-that-are-larger-than-the-limitations-of-a-cu/55321155#55321155), which stores and retrieves a 3.5MB image. Also the limit of a CursorWindow is now 2MB (as can be seen from the link Q and A in the log). – MikeT Mar 24 '19 at 06:11