why all suggest using PNG instead of GIF ,JPG images in iphone? [duplicate] - iphone

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
When to use PNG or JPG in iPhone development?
I want to know why all suggest to use .png images instead of.jpg and .gif images for iphone applications. What is the problem when we use .gif or .jpg images. Is Apple doesn't support applications using non .png images. Please clarify me .
Thanks in advance

The iPhone is specifically optimized to handle PNG images very efficiently. It doesn't have the same optimizations for GIF and JPEG.
In addition, if you add a PNG file as part of your XCode project, then XCode will convert the PNG file into an Apple specific variant of PNG. There seems to be no official documentation about the format, but it is said to differ from the official PNG format in byte-swapping (BGR instead of RGB) and pre-multiplied alpha channels. These changes further reduce the amount of work the iPhone has to do at run-time.

Presumably because it supports an alpha channel for transparency, nicer for UI work.

.jpg is lossy compression and so has a different purpose than .gif and .png, which are lossless.
.png files support more colors than .gif and can be smaller, depending on the image. .gif used to be patent-encumbered but AFAIK those patents have expired.
.jpg is appropriate for larger images that need more compression than a lossless format can provide, especially real photos where artifacts of lossy compression will be less obvious. If the image is small or based on vector graphics where compression artifacts are obvious, lossless is preferred.

Related

High Resolution Web SDK preserve PNG transparency

Using High Resolution SDK. Aviary is fully functional on jpg images. As for png images, transparency area are replaced with black when saved. (fileFormat is already set to png). How to preserve transparency when saving edited png files?
png in editor,
png after save
PNG transparency is currently not officially supported by the Creative SDK Image Editor. There is no API to turn on support for transparency using the high resolution API.

iPhone graphics: format for photo with transparency?

I have some graphics I want to import into iPhone application. They are people / animals from photos that I cropped out that so they have transparent backgrounds. Obviously, I can't use JPEG as is traditionally recommended for photos because of transparency so what would be the second best option? I'm currently using png-24, but I assume that's too big. Is gif OK? Or something else?
It is recommended by Apple to use PNG whenever possible. PNG is still a compressed format so I think you'll be fine with respect to size.

How to convert PNG image to GIF in iPhone programmatically

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.

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

can we use .jpg format images for mobile applications I.e iphone and android

i am working on mobile application where i need to display a background image using css sprites. here is the problem image size is 1600px width and 480px height. when i convert this image to png the file size is 400kb. and in jpg format it is 80kb.
So, my question is whether can i use the jpg format image in mobile application. especially in iphone and android........?
Thanks in Advance....
Yes
We can use jpg files BUT it is preferred to use png files as they are very lightweight to use.So as far as mobile apps are concerned png are the ones used.
Cheers