1

I have an app that takes a photo with the ipad camera and saves it in a sql database.

Is there away i can take a low resolution picture or a way i can reduce the picture resolution before i save it to the database.

thanks

user2461593
  • 87
  • 1
  • 8
  • 1
    Just pick a maximum dimension (say, 1024px) and resize the image (http://stackoverflow.com/a/613380/155187) before saving it. – warrenm Jul 14 '13 at 23:24
  • 1
    Incidentally, when you say, SQL database, do you mean a local SQLite database (which can be done, but it is poorly suited for storing images other than thumbnails) or uploading to some other SQL DBMS (which is fine)? – Rob Jul 14 '13 at 23:28
  • hi there i will give them a try, currently sql locally but next phase will be server basing the database. Not best way but what i been instructed by bosses to do. – user2461593 Jul 14 '13 at 23:32

1 Answers1

1

You can use UIImageJPEGRepresentation to reduce the quality. JPEGs are also much smaller than PNGs, if that's what you're currently saving them as.

NSData *jpegData = UIImageJPEGRepresentation(image, .8);
MaxGabriel
  • 7,617
  • 4
  • 35
  • 82