Jpegs and pngs
gyroscope
I am here.Member, Sous Chef, PRO Posts: 6,598
Hi, still a bit confused about pic file format brought into GS, made in Photoshop. (I thought it was straightforward a couple of weeks ago and gave some dodgy advice, sorry about that!)
So now I've learned that all but the iPhone4 can only show 8 bit pics, and that dithering on gradients is the only way to deal with them in a fairly successful manner. (Even the iPad can only show 8 bit pngs, I'm guessing).
If there's no transparency, I can use jpegs. If there is transparency, use png-8. OK, under the dropdown menu showing the type of image wanted in Save for Web in Photoshop, is another menu which includes Restrictive (Web). Two questions here: is this the one that I should choose every time, along with 100% dither, when dealing with pngs?
So next, if there's no transparency involved, I can use the highest quality jpeg, I guess? I'm wondering why there's no dither option to dither the gradients in the jpeg pic; jpeg seems to show the gradients in the preview just fine. And presumably this would be a 24 bit jpeg; there doesn't seem to be any option to get a jpeg-8, as opposed to a jpeg-24, if there is such a thing. Hope I've described my confusion here clearly enough.
One final thing, as far as I've learned, steer well clear of drop shadows fading into the transparency surrounding a png. They look awful whichever options are chosen, as well as showing a white stroke around the image. Would you agree with that?
Any more info/help here appreciated, thanks!
So now I've learned that all but the iPhone4 can only show 8 bit pics, and that dithering on gradients is the only way to deal with them in a fairly successful manner. (Even the iPad can only show 8 bit pngs, I'm guessing).
If there's no transparency, I can use jpegs. If there is transparency, use png-8. OK, under the dropdown menu showing the type of image wanted in Save for Web in Photoshop, is another menu which includes Restrictive (Web). Two questions here: is this the one that I should choose every time, along with 100% dither, when dealing with pngs?
So next, if there's no transparency involved, I can use the highest quality jpeg, I guess? I'm wondering why there's no dither option to dither the gradients in the jpeg pic; jpeg seems to show the gradients in the preview just fine. And presumably this would be a 24 bit jpeg; there doesn't seem to be any option to get a jpeg-8, as opposed to a jpeg-24, if there is such a thing. Hope I've described my confusion here clearly enough.
One final thing, as far as I've learned, steer well clear of drop shadows fading into the transparency surrounding a png. They look awful whichever options are chosen, as well as showing a white stroke around the image. Would you agree with that?
Any more info/help here appreciated, thanks!
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Comments
Also Xcode "optimizes" PNGs as part of the build process.
Regarding Photoshop, If your trying to save size then try the PNG 8-bit version, but if you need transparency then you need the PNG 24-bit version.
You most certainly can use transparent drop shadows, use the 24 bit png option, works great, but is a bit bigger in file size. I've used fading drop shadows with 24 bit pngs in all my apps.
_______________
Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
A couple more questions though; presumably when using png-24, even if GS doesn't convert them, iPhone will? (apart from iPhone4).
I've been getting some disappointing results saving pngs in the Save for Web option in Photoshop. This was recommended to me; but going back to the usual Save and choosing png that way, the results are just right again. In Image>Mode, I'm using 8 bits per channel (RGB) which presumably is the same as png-8?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I'm not sure why you are not getting good results with "save for web", that has always been my preferred method, as it gives you precise previews and deletes unwanted overhead, like an icon preview.
In terms of the iphone 4, it has a Retina display so while the screen looks the same size as a standard iphone, the image resolution is double.
Older iphone = 480x320 @72dpi
iphone 4 = 960x640@72dpi
Although GS is not yet iphone 4 retina ready in the end the way things stand if you want to take advantage of the iphone 4's retina display then you will need to have 2 images, one of which will be labelled '@2x' for the iphone 4 to pick up on.
image.png - older iphone
image@2x.png - iphone 4
Good luck
JCFord
But if you're using png-24 and it looks just fine on iDevices, that's well good enough for me, design219, thanks!
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
8 bits per channel means a choice of 256 reds, 256 blues, and 256 greens - or 16.8 MILLION colors for the entire image.
JPEGs and PNG24s both support this amount of colors. 8bit images look beautiful. ALL digital cameras take 8bit images. Pretty much everything on a computer that you have ever seen is an 8bit image.
Where I think you are getting confused brings me to your next point... There are 2 types of PNGs - PNG-24 and PNG-8.
PNG-24s support 16.8 million colors, as well as a full 8bit alpha channel. So if you need transparency, use the PNG-24 format.
PNG-8 (and I think this is where the confusion is coming from) only supports 256 colors per IMAGE. When you save your image as a PNG-8, the PNG-8 algorithm selects the best 256 colors (out of the 16.8 million you used) to redraw the image. This makes the image very light and quick to render. It is similar to an old web file format called GIF (which GameSalad does not support). JPEGs on the other hand use 16.8 million colors, but are compressed, and take a weensy bit more time to display. Although this is not really even noticeable anymore. It might become an issue if you have tons of JPEGs to display at once, but even then it is probably negligible. When saving for PNG-8 in Photoshop, I get the best results with Perceptual or Selective. 100% dither. JPEGs are all 16.8 million colors (or 24bit - which is 8bits per channel). You can adjust the amount of compression on them however - the quality setting you mentioned. The less the quality, the more compressed they are, thus the file size is much smaller - but they look worse.
In this instance, you can also use a PNG-24, which is also 16.8 million colors.
Personally, I only use PNGs. Either PNG-24 for graphics that need transparency, or PNG-8 for ones that don't. The PNG-8 files do look a little more pixellated, but the iPhone's pixels are so small that it doesn't really matter too much. It is probably my old school way of thinking, but I BELIEVE that that PNG-8s render faster than JPEGs, and I want to eke out as much performance as I can from these devices. But like I said, it probably doesn't matter anymore. Just a habit. Gradients will look perfect if you use either JPEGs or PNG-24s. They will look pixellated and banded if you use PNG-8.
However, they is currently an issue on the iPhone (specifically the OpenGL renderer) that causes banding in a gradient - even if it was saved correctly as a PNG-24 or JPEG. There are some fixes out there, but we don't have access to them in GameSalad. In the meantime, if your image needs to have a gradient, a quick and dirty solution is to put a layer of noise (like TV static, using the Noise filter) at 5% opacity above the gradient. It is hardly noticeable, and will fix the banding in the image on the device. They will look awful if you save it as PNG-8. If you want any sort of drop shadow or glow on your transparent image, save it as PNG-24 and it will look perfect.
Phew!
Hope this helps!
Joe
EDIT: Seems some people have answered your questions while I have been composing this novel!
Only use PNG 8 if your image does not have transparency and you want to save space, as the image quality will be slightly less.
So to summarize: totally forget jpegs, put 5% noise on all images as a matter of course, and save in png-24 only; and then everything works out fine on the Iphone/iPad screen? That's excellent news.
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
If you have the room, just use PNG-24s across the board.
Only use the noise trick if you have a large gradient that causes banding on the device.
:-)
I feel like a "cheapskate" though for giving such a short reply to your comprehensive post!!
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps