ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • resource 압축 방법 from Nokia forum
    Computer/J2ME for GSM 2005. 3. 17. 04:26

    You can also save space by concatenating the files into one. You can do this in Windows from a command line, using the copy command.

    copy /b first.png + second.png + third.png allpngs.dat

    Type copy /? for details. If you load the complete file ("allpngs.dat") into a byte array, individual images can be extracted using the Image.createImage (byte [] buffer, int offset, int size) method. You will need to work out the size of each PNG, and the starting point of each PNG within the combined file (the total size of all PNGs before it).

    This is particularly effective when using 256-colour images, especially if they all have the same palette. Paint Shop Pro has a facility for saving and loading palettes that can help in this. If you have many 256-colour images with different palettes, follow this process:

    1. create a large, 16 million-colour image
    2. copy and paste each 256-colour image onto the 16 million-colour image
    3. reduce the colour depth to 256 colours; this will make a palette containing the colours from all images (or best matches)
    4. save the palette from this combined image
    5. load the saved palette into each individual image.

    You can do this and keep transparency. I use this technique on small (12x12) icons with transparency. When I add the combined file to the jar, I get around 85% compression.

    This technique generally involves a lower run-time memory overhead, as the PNGs are not expanded to their usual (bulky) in-memory format until you extract them. But you should, of course, be sure to garbage the byte array into which the file was loaded after you have extracted all the images. Processing overhead is also minimal.

    Graham.

Designed by Tistory.