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
Related
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.
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.
I'm about to start a new iphone/ipad project which required a library of images. I've been trying to find if there are any pieces of software which would automatically resize images and save them in the right format for iphone and ipad... no such luck as yet!
So, I have large images of all different sizes. I need to create three images from each one.
iPad, iPhone (high res), iPhone (normal res)
I was thinking of recording something in Photoshop, but wondered if there's anything out there which already does this? My trouble is that I need to resize based on either the width or the height (which ever is larger).
Thanks for any tips!
Unless all your graphics are rasterized it might be better to do the resizing through Photoshop, that way you don't lose the pretty vector resizing. In Photoshop, I'd recommend checking out Export Layers to Files and Layer Comps to Files under File>Scripts. They've both proven invaluable while dealing with massive image libraries for universal apps.
How about some batch image resizer freeware, like this?
http://www.fotosizer.com/
i was currently in to an app development and i have added a launcher screen in JPEG format which is displayed both in simulator and device .. but does it create any problem with apple approval guidelines ?
Update for iOS 8+: you can now use XIB-based launch assets, which is by far the best approach to reduce file size and re-use the same assets for multiple screens sizes. Also, since XIBs support JPG assets, you can always embed JPGs onto XIB files now too!
The Apple documentation pre iOS 8 (now removed), explicitly stated that only PNG is allowed for the launch image:
App Launch (Default) Images
Every app must provide at least one launch image. This image is
typically in a file named Default.png that displays your app’s initial
screen in a portrait orientation. However, you can also provide other
launch images to be used under different launch conditions. All launch
images must be PNG files and must reside in the top level of your
app’s bundle directory. (Avoid using interlaced PNGs.)
I can't speak to how accurate this document is, but it seems they are pretty specific on this point.
My advice: use 8-bit PNG's, and if your files are getting to big, simply don't include the #2x versions for the retina iPad. The 1x version upscales reasonably well on the retina iPad, and better than bloating your app by 5MB+
Yes ofcourse you can use JPEG image in Launch screen or anywhere in project.NO it absolutely does not create any problems in approval process of Apple.So go ahead and code!
Use a png if you can; not only is png artwork better visually, but iOS is optimised for png files.
While it is true Apple won't reject your app for using a jpeg, your users might.
NO you should not use jpgs
Here are apple recomendations
Note: For all images and icons, the PNG format is recommended.
The standard bit depth for icons and images is 24 bits (8 bits each for red, green, and blue), plus an 8-bit alpha channel.
You do not need to constrain your palette to web-safe colors. Although you can use alpha transparency in the icons you create for navigation bars, toolbars, and tab bars, do not use it in application icons.
You can only use PNG files for the launch images. Here is the proof.
Yes , you can choose any one from JPEG/PNG.There is no guidelines from apple to choose type of image.
For more information you can follow apple launch image guidelines.
but I assume that PNGs are more preferable because Apple seems to use PNGs virtually everywhere in iPhone OS.
A question for the seasoned iPhone developers, what is your preference for graphics in an iPhone app? I have turned to PNGs because I read that is the preferred image format and they are the most efficient format for the OS in terms of performance. However I had read you should try to use svg graphics so they scale up on the iPad. I started reading up on svg for my next app and thought the format was natively supported by UIImageView, but it seems you can only render them in UIWebviews or programatically. My belief was a lot of the latest graphically-rich apps used svg graphics, is that an incorrect assumption?
Thanks for any advice/comments.
I think using SVG graphics would cause a ton of problems and I'm not aware of any apps that use it. It's probably a much better idea to use PNGs and just have different sizes for iPhone, iPhone 4 and iPad.