Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Image Optimization for JavaME

From Wiki
Jump to: navigation, search
Article Metadata
Created: senthil_k (29 Jan 2008)
Last edited: lpvalente (01 Mar 2014)

Since size optimization is a major process while creating Java ME applications, we have to take special care to optimize the images before they are used in the application.

Following are a few tips on how to optimize especially 'PNG' images (since they are mostly used because of transparency support and small size).

  1. When images are created using image editors like Photoshop, then special care should be taken so that the images are saved in the minimum size. For example, before saving the images, the unwanted colors should be removed. If your game/application requires transparency, then the image should be saved in 32-bit format. If this is not required you can go for 8-bit or 24-bit images, which will definitely reduce the image size. Before doing that you have to make sure the image looks good, and details are not lost.
  2. After the images are created using image editors, you can go for 3rd party image optimizer utilities to optimize the images, following are some of them:
    1. Pngcrush  : Pngcrush is an optimizer for PNG (Portable Network Graphics) files. It can be run from a command line in an MSDOS window, or from a UNIX or LINUX command line.Its main purpose is to reduce the size of the PNG IDAT datastream by trying various compression levels an PNG filter methods. It also can be used to remove unwanted ancillary chunks, or to add certain chunks including gAMA, tRNS, iCCP, and textual chunks.
    2. OptiPNG: Advanced PNG Optimizer (): OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections. It is based on Pngcrush
    3. PNGOUT: PNGOUT is a tool which can optimize PNG files created by other programs. It can be run from the Windows Run dialog box or at the command prompt. PNGOUT can produce even smaller files than pngcrush -brute or optipng -o7, however, since PNGOUT does not automate trials, you will have to find the right options yourself. PNGOUT Tutorial
  3. For games you may be using a number of images, in such cases if possible you may try to combine a number of images & form it into one. The advantage of using this is that if the images are present individually, then each image will have an header & also some other details which add to the jar size. If the images are combined then all together they will have a single header & details.
  4. You may also try, keeping the images after removing the headers. Now the images will be in byte format. This will definitely reduce the application size.
This page was last modified on 1 March 2014, at 14:07.
46 page views in the last 30 days.