Any example please how to draw image loaded from iPhone photo album ?
I see on the iOS OF Examples ( OF v0072_iOS_release) are only how to draw image from camera …and i modify the code to open the photo album but the app crash when i select the photo from photoalbum.
thanks.
I’m running into the same problem.
As far as I understand we cannot access images from a library in the same way we access camera images, which makes sense because open framework here actually needs that we wait until we’ve chosen an image and then retrieve that one. However, also cannot figure out what is the “right” way to do it… did you get any further?
@sure_m
No, I have not found a solution for this. No one is interested in my problem, and there is no example in iOS example apps how to get/write images from photoalbum.
I’m experimented with cinder and looks more promising than openframeworks. Also on Cinder forum you can find help and they respond to all beginners questions. I like openframeworks but support from the community is very poor…
Sorry for my english.
I think I don’t agree on this too much, normally you get support here quite quickly. at least all my earlier question have ben answered
good luck with cinder, I’ll dig deeper into the iOS storing mechanisms…
Note there seems to be a bug with the de-allaocation of the image picker.
I’ll add the bug to the GH repo - but in the meantime try commenting out line 209 from ofxiPhoneImagePicker.mm
//_imagePicker.cameraOverlayView = nil;
Sorry to leave you guys hanging with this, going to get our iOS guy to cleanup the class and make it much clearer how to use it.
I commented the _imagePicker.cameraOverlayView = nil; but that does not change the xcode warning…
I try to allocate the “photo” in setup() method and work : photo.allocate(ofGetWidth(), ofGetHeight(), OF_IMAGE_COLOR_ALPHA); This may not be the right solution,but the xcode allocate warnings has gone after this.
Maybe could you try running that example ( just take the iOS empty example and copy and replace the gist over the testApp.mm file ) and see if you still get the warning you were mentioning?
Also at some point it would be good to switch to 0073 as there a couple of bugs in 0072 which are not good for production code.
@theo: thanks for the reply. as said I had posted the same question here http://forum.openframeworks.cc/t/loading-image-from-ios-photo-library-with-ofxiphoneimagepicker/11498/1 (there is also my code).
thanks for the link. It does work but I am wondering how I can use the photo I’m choosing in my app?
(errors disappear with the github example, without even without uncommenting the “_imagePicker.cameraOverlayView = nil;” as you mentioned… so well done there but how do I use that photo in my app??)
UPDATE:
I think I figured it out myself. As I see when I touched next it was reopening the photo library so I just added a variable that I set false in the setup and as soon as the image is chosen I set it to true and don’t go to the opening the library any more… looks like this in the touchDown then
Don’t know if that’s the most elegant way to deal with it but it seems to work… other suggestions welcome though… (also could I load several images into an array with only opening the photo library once?)
well now you have the image as an ofImage ( called ‘photo’ ).
So you can now draw it to the screen. You can resize it or do anything that ofImage can do.
What are you trying to do with the photo in your app?
just updated my reply above. think it is solved for now. need to think about if this is useful for my purpose (as the user needs to pick the images, but I would rather want to load them automatically). Good learning experience anyways, I will check out the XML way and as it seems I could store the images as xmls and those could be read automatically right?
I really don’t understand the role of “delete camera” here if “camera->close()” doing the ‘work’ that is supposed to do. As for memory leak I see the imagepicker (close) inside ofxiPhoneImagePicker.m is deallocated in - (void)dealloc.
I expect more changes for iOS on OF_074. I hope that will be in the next OF version.