This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes Why did it have to be PNG Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Why did it have to be PNG" Watch "Why did it have to be PNG" New topic
Author

Why did it have to be PNG

Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
Hi
I have been working on writing J2ME applications for the last few months or
more. I have written MIDLets that display certain images from the net on my
mobile phone. Since images have to displayed on the mobile phone I have to
convert the image into PNG format so that it can be displayed on the mobile
phone, I am not performing the image conversion on the mobile since there
are not ready made APIs to do the job, so the image conversion is done in a
intermediate server that sits between the mobile applicaion and the actual
application that provides the image.
Writing the program to convert a jpg or a gif image to a PNG image does not
prove to be a major problem, but it does include a performance hit, since
the midlet is no longer getting the image from the source web site it has
to tunner through my web site that converts the original jpg image into png
format ( is there a better or a faster method to do this ?) .
I was wondering as to why PNG was selected as format of the image that can
be displayed using J2ME, when most of the images on the net are jpg or gif
images. Image conversion is not the only problem when I convert the image
from JPEG to PNG, there is major increase in size ( tested for
16 bit 128x128 images) which reduces the network performance even more
( that is particulary a problem since mobile networks are slow unless you
are using GRPS which should be a bit faster but not that fast ).
So here is what my intermediate servlet does
1. Fetch the actualy image ( jpg/gif format)
2. Reduce the size (dimentions)of the image so that it can be displayed on
the mobile screen.
3. Reduce the color depth of the image to 4096 colors ( this is required
since my Nokia 7210 can display only 4096 colors so it does not make sense
sending truecolor images which are als larger in size )
4. Convert the image into PNG format so that it can be displayed on the
mobile phone using J2ME.
This image conversion really seems useless for my Nokia 7210 since it can
directly display jpg images, but not through j2me since j2me only allows
png images to be displayed. I dont think I can use the Nokia j2me API to
display jpg images ??? Can I ??? --- If that is possible please feel free
to fire me!!
So is there any particular reason to choose PNG over other popular internet
imaging format ???
And I dont think I ever heard of PNG before this.......
vivek


Vivek Viswanathan SCJP 1.2, SCJP 1.6,SCJD,SCEA,SCWCD,IBM-484,IBM-486,IBM-141,Ms.NET C# 70-316,SCMAD, LPIC-I
M.K.A. Monster
Ranch Hand

Joined: May 02, 2002
Posts: 130
As I fas as I know using GIF is not allowed, you would need I license for that I think.
JPG isn't allowed because it uses a lot cpu-power. For decompressing it. At least that was what the i-mode guys used to tell me.
Why should we choose PNG? Because PNG(pronounced PING) is license free. Supports both colormapped and truecolor images (not just 24 bits, even 48 bits).
For the Web, PNG really has three main advantages over GIF: alpha channels (variable transparency), gamma correction (cross-platform control of image brightness), and two-dimensional interlacing (a method of progressive display).
For getting smaller images (png) you should try to optimize them.
Regards,
Mark Monster
Originally posted by Vivek Viswanathan:
Hi
I have been working on writing J2ME applications for the last few months or
more. I have written MIDLets that display certain images from the net on my
mobile phone. Since images have to displayed on the mobile phone I have to
convert the image into PNG format so that it can be displayed on the mobile
phone, I am not performing the image conversion on the mobile since there
are not ready made APIs to do the job, so the image conversion is done in a
intermediate server that sits between the mobile applicaion and the actual
application that provides the image.
Writing the program to convert a jpg or a gif image to a PNG image does not
prove to be a major problem, but it does include a performance hit, since
the midlet is no longer getting the image from the source web site it has
to tunner through my web site that converts the original jpg image into png
format ( is there a better or a faster method to do this ?) .
I was wondering as to why PNG was selected as format of the image that can
be displayed using J2ME, when most of the images on the net are jpg or gif
images. Image conversion is not the only problem when I convert the image
from JPEG to PNG, there is major increase in size ( tested for
16 bit 128x128 images) which reduces the network performance even more
( that is particulary a problem since mobile networks are slow unless you
are using GRPS which should be a bit faster but not that fast ).
So here is what my intermediate servlet does
1. Fetch the actualy image ( jpg/gif format)
2. Reduce the size (dimentions)of the image so that it can be displayed on
the mobile screen.
3. Reduce the color depth of the image to 4096 colors ( this is required
since my Nokia 7210 can display only 4096 colors so it does not make sense
sending truecolor images which are als larger in size )
4. Convert the image into PNG format so that it can be displayed on the
mobile phone using J2ME.
This image conversion really seems useless for my Nokia 7210 since it can
directly display jpg images, but not through j2me since j2me only allows
png images to be displayed. I dont think I can use the Nokia j2me API to
display jpg images ??? Can I ??? --- If that is possible please feel free
to fire me!!
So is there any particular reason to choose PNG over other popular internet
imaging format ???
And I dont think I ever heard of PNG before this.......
vivek
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
M.K.A. is correct that a license is needed for gif.


Matthew Phillips
Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
Thanks a lot for that information.
A few more questions 'i-mode' ..who r they ?
Does MIDP1.0 ( which most phones have ) support alpha channels (variable transparency), gamma correction (cross-platform control of image brightness), and two-dimensional interlacing (a method of progressive display)???
How should I optimize the image ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why did it have to be PNG