I am creating an app in which I need to copy image from IOS Photo library to the app's Document directory and then upload the file to the server. I'm using the UIImagePickerController to select the image from the Photo library and save it in the app folder. It works good for the "jpeg" and "png" images using UIImageJPEGRepresentation and UIImagePNGRepresentation.
I don't see any option to copy and save the "gif" images in IOS. Is it possible to save the animated gif images. Please throw some light on how to process and save the original images (bmp, jpg, gif, png, tiff, etc.,).
Thanks in advance.
While you can load them (though you need to split them up for animations; Add animated Gif image in Iphone UIImageView - note the convert command near the bottom) one cannot save them.
To save them you'll need to use a third party library.
See this question, How to save a GIF on the iPhone?, and this http://jitsik.com/wordpress/?p=208 library for a solution.
Related
When saving a photo in Corona SDK. Regardless of the method used it seems no to be possible to capture any offscreen contents. For instance a 500x500 image displayed on a 320x480 device would be cropped at 320x480 when saved with display.save()
Is there a workaround for this? Is it possible to.
Save offscreen content?
Save or use an image directly from the device photo library?
Thanks for your help.
I don't think there is a way to capture offscreen content using Corona. Maybe there is a workaround to your whole problem if you give us more details.
Have you looked at the media.show function. With this you can load images from the photo library or the camera. It has option to either show the image directly on the screen or just save it to the sandbox.
I manipulated some images replacing the thumbnail present in the photo exif header. I would be interested in transferring such a photo to an iPhone anyway everytime I transfer it via e-email or in some other way exif informations are wiped out.
I would be also interested into know if it is possible to replace such informations, like thumbnail header exif, directly in an iphone app through iOS Sdk and then save the modified photo in the photo roll without loosing the exif header.
You will have to first save the image during which iPhone will add default EXIF information. The you will have to read the image using ALAssetLibrary and modify the EXIF.
I'm trying to understand if phonegap can be used for local image manipulation. I'm looking to add a caption to an image from the camera roll and save the modified copy back in the camera roll. For example I might have a picture of a cat in phone. I want to open it, add some lolcats style text and save the modified copy in the camera roll.
Is it possible to achieve this in phonegap?
Thanks
You can use HTML5 Canvas to update the images and save it locally in your application space. However saving the image to the phone album is not straight forward. You may need to look at the below post to get the proper solution.
How Can I Save An Image To An iPhone Photo Gallery Using PhoneGap?
This post will help you open the album image to canvas
CameraRoll image to canvas using Phonegap
How to picker some pictures from the library, and convert them to a gif?
There's ImageMagick for iPhone.Check Using ImageMagick to create animated GIFs on the iPhone.
Or search "ImageMagick for iphone" at Google
Check these Links
According to Apple,
Xcode automatically optimizes your PNG images using the pngcrush
utility shipped with the SDK. (You’ll find the program in the iPhoneOS
platform folders in /Developer. Run it from the command line with the
–iphoneswitch to convert standard PNG files to iPhone- formatted
ones.) For this reason,use PNG images in your iPhone apps where
possible as your preferred image format.
Better prefer to use PNG's for your image requirements
For Picking Image :
http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/
http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/TakingPicturesAndMovies.html#//apple_ref/doc/uid/TP40010406
For Conversion :
http://blog.objectgraph.com/index.php/2010/04/05/download-an-image-and-save-it-as-png-or-jpeg-in-iphone-sdk/
Hope this Helps
You can create a GIF using the ImageIO framework, which is part of the iOS SDK. You don't need ImageMagick or any other third-party library.
Look at this answer for code that uses ImageIO to create an animated GIF. If you don't want an animated GIF, just add a single image instead of a bunch of images.
As for picking images from the library, there are many questions about this already on stackoverflow. Just search for [iphone] pick image from library.
How can I add some photos to the simulator photo library?
Open safari in simulator .. search for any type of images (.jpg images, .png etc.), later finding the image give a long press on that image for few seconds .. an action window will open with these buttons inside it Save Image, Copy, Cancel. Press save, then the images will be saved into the Photos Library.
Use simulators web browser to find some pictures and save them.