How to convert PNG image to GIF in iPhone programmatically - iphone

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.

Related

Can SVG images be used?

For some reason, I can't get SVG images to show up on my phone, only the simulator. Is this bug / feature that is in progress / expected? I can't find any documentation on file formats in the guide.
Don't know if this affects it, but I'm using API.AI's Actions on Google tab to create the carousel.
Thanks in advance!
The phone doesn't support SVG, and that's the expected behavior.
You can use JPG, PNG or even GIF with animations.
I agree that this should be available in the documentation.

IOS save gif image from UIImagePickerController selected image

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.

Why extensive use of png images in iPhone development?

Is it true that we have to use png images for development in iPhone and iPad. What is the advantage we would gain when using png images?
Apple has said that Xcode will optimize PNGs during the build process.
This article explains exactly what it is doing, and why PNGs are preferred over other formats on the iPhone. In other words, you will lose performance by using any other formats, as the conversion must be done at runtime.
http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html
You dont have to use png. You can use gif, jpeg, and others. If you use png, xcode will optimize them for the iOS loader (changes the byte-order of some data in the png; I'm not clear on this exactly) resulting in faster loading images.
PNG supports alpha transparency (GIF only support transparent pixels, not semi-transparent) and the quality is good (not like JPEG).
It also supports loseless compression.
This similar question goes over this: When to use PNG or JPG in iPhone development?
Pngs are a lossless format so for design, buttons, etc... for iphone/ipad what you see in photoshop (or whatever) is going to be exactly what you get as opposed to jpegs which use compressions.
That post also said that pngs use less processor to be displayed since they are uncompressed.
#Krishnan the main advantage of using the png images is they are very light weighted......and as u know memory management is a very big issue in iphone and ipad development...thats why we use them....and for more detailed information look here

Display large PDF using iPhone SDK

I was wondering what is the best way to display a big PDF file (it's a map actually) using iPhone SDK (the file is around 5MB), because it's really slow in a UIWebView.
I want to be able to scroll through the PDF and zoom in/out.
Also do you think that it would be better to convert it to a PNG?
Thank in advance
You can display the PDF using quartz it is faster, but it requires more code to handle it. You can download the quartz example from Apple. The only drawback I have seen is that zooming isn't as smooth.

How can I load vector image directly with iPhone SDK?

How can I load vector image directly with iPhone SDK? Just as UIImage loads bitmap images.
I did this recently using PDF. I saved some resolution independent images directly from Illustrator (using the smallest file size preset). I have some code (gists) here.
As of iPhone OS 2.1, the iPhone's WebKit supports SVG graphics natively. You should be able to use a UIWebView to load the SVG element for display. This question provides some sample code for doing so.