Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Images types - JPG vs PNG

[ Edited ]

This is probably a dumb question....but...

 

Does the PlayBook only support *.png (PNG) files for images? Or is it only for specific things such as the application icons etc.

 

I wanted to have some pictures in my app, and the PNG versions are 700 KB where was the JPG versions are only 30KB. Can I have JPG images?

 

Thanks!

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Images types - JPG vs PNG

[ Edited ]

PNG is fine for application images.  I use them exclusively for images and icons.

JPG for higher res is good too.

Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Images types - JPG vs PNG

Hey John,

 

thanks for the reply.
What I realized was that if I merely change the file extension to .png, the file remains the same size, which is fine. BUT if I open the JPG in photoshop or paint.net and save it as a png, the file size jumps from 35kb to 700kb. 
I guess either way, I'll stick to just manually changing the file extensions. I hope nothing messes up!
GP

 

Please use plain text.
Developer
willyyr
Posts: 229
Registered: ‎08-14-2009
My Device: Bold 9900, DevAlpha A
My Carrier: Vodafone DE

Re: Images types - JPG vs PNG

To minimize the size of my png files i use this little tool: http://advsys.net/ken/utils.htm (PNGOUT.EXE). I tried several others (just google for png optimizer) but had the best results with this one. I don't think just changing the file extension manually makes it a real png. E.g. this probably won't support transparency. A good article about the difference between png and jpg: http://www.turnkeylinux.org/blog/png-vs-jpg

 

Hope this helps.

Willy R.
-
If my post solved your problem, make it easier for others to find by Accepting it as a solution or provide a Kudo if it was helpful for you. Thanks.
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Images types - JPG vs PNG

 


gpatton wrote:
What I realized was that if I merely change the file extension to .png, the file remains the same size, which is fine. BUT if I open the JPG in photoshop or paint.net and save it as a png, the file size jumps from 35kb to 700kb. 
I guess either way, I'll stick to just manually changing the file extensions. I hope nothing messes up!

 

@gpatton, it almost sounds like you have JPG files but are saying you want to change the file extension to PNG and think that will somehow magically make them PNG files?  That's not how it works and it very likely will "mess up" something.

 

First of all, you should generally use PNG files (actual ones, not just files with .png on the end) for things like drawings, cartoons, and similar images, but use JPG files for photographs or extremely complex images where file size is much more important than fidelity.  JPG is a "lossy" compression format, tuned (I believe) to human perception of colours, intensity, and so on.  Images expanded from a JPG file are not perfectly true to the original but are "good enough" most of the time.  PNG is a lossless compression format, but that's usually a terrible way to store photographs as the file size ends up so large.  (It looks like when you say "images" you meant "photograph", but image really just means any kind of picture, whether computer-generated drawing, cartoon, photo, graph, or other.)

 

Now to the specific point: these two formats are entirely different inside, so if you have one and just change the file extension, that does nothing useful for you.  It's still a file of the same type as you started with, though you just confused some braindead software.  If you load a file that was saved in one format, however, and "Save As" (or "Export") as the other format, the file size will certainly be much different most of the time as you've just changed the actual format.

 

If you had a file that was really a JPG and saved it as PNG, it could well grow from 35k to 700k if it was a photograph.

 

The simplest way to tell if a file is PNG or JPG is to use "type <filename>" at a command prompt (or the "cat" command, on a Mac/Linux system).  If you see the letters PNG it's a PNG.  If you see some random-looking **bleep** and JFIF (or Exif) buried inside near the start, it's a JPG.  A better approach is to use a decent image processing tool (maybe IrfanView) which will tell you the correct format if you open the file, regardless of the file extension.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Images types - JPG vs PNG

Thanks to everyone for their responses.

 

I knew something was fishy when I could just rename the file extension from png to jpg.

 

Since I asked in one of my previous posts about application sizes, I was worried that my application would be too big. I was also worried that the PlayBook would only accept PNG files. But now that  I know, that Playbook can also do JPG files, it seems more obvious to use that format. (700kb PNG files vs. 30kb JPGs....hmm which one to choose?)

 

So I've decided to stick with the *.jpg extensions. These "images" will be used as my background for my app, where users can change their backgrounds as they please. Since there really isn't any "re-saving" of the file, I'm guessing a JPG will do since there wont be any loss in image quality.

 

Any other suggestions would as well. I'm hoping JPG will do. 

 

Thanks once again!

 

 

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Images types - JPG vs PNG

You can also reduce the quality of a JPEG image to about 60-75% without too much visual loss and save a considerable amount of file size too. Most image editors allow you to re-save a JPEG image with a parameter to reduce overall quality.
Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Images types - JPG vs PNG

Sounds good.

 

One more question though.

I just realized some of my images are at 96dpi (same as 96 pixels per inch)? 

 

And I also remember from the webcasts that the resolution for the playbook is 170dpi.

 

Although my images are at 1024X600, will the 96dpi images appear properly without any loss of quality? They appear fine on the simulator,  but I have my doubts.

 

G

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Images types - JPG vs PNG

 


gpatton wrote:

I just realized some of my images are at 96dpi (same as 96 pixels per inch)? 

 

And I also remember from the webcasts that the resolution for the playbook is 170dpi.

 

Although my images are at 1024X600, will the 96dpi images appear properly without any loss of quality?


Dots-per-inch is not really a property of images per se.  It's a property of devices that show the pixels (i.e. displays).  An image has only a resolution and when displayed on a particular display it will have whatever dot-pitch that display has.

 

 

Basically, what you see on the simulator should be exactly what you see on the actual device, except that all the pixels are smaller on the device than they are on your own monitor, so the overall image size is smaller.  If you get a ruler and hold it up to your screen, you can calculate exactly how much smaller it will be, if you want to compare.

 

(In some contexts, an image may have a "dpi" property associated with it.  This is meaningless except in a context where the this value is used to determine a desired physical size for the image on a display.  This is used only to calculate a scaling factor, however, to adjust the "image dpi" to the "display dpi".  I believe you can ignore all of this as far as what you are doing here.)


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.