The Polyomino Compressed Format applet
The algorithm has been realized in the Java language to guarantee compatibility over various platforms and to allow an easy use of it in network enviroments, such as web pages. The program downloadable in this page shows how files compressed throught the PCIF algorithm can be easily viewed in a web page throught an applet using any Java supporting browser on any operating system.
Note that the code and program given below are for demonstrative purpose only. The applet is still not suitable for a real page because if used on multiple images it would cause to start the algorithm on all images at the same time, causing a high memory usage and general slowdown of the visualization. What should be realized is a mechanism to decompress only 3-4 images at a time starting from the top of the page (this is what browsers automatically do for jpeg and png images). This could be one of the next developments of the software.
Before downloading any of the files available on this site you must have read and accepted in all its terms the agreement about the PCIF software.
The applet itself is represented by the class pcfapplet.pcfapplet.class and it requires an only parameter image representing the (eventually relative) URL where the image is stored. Because of the security restrictions applied to applets these can only open connections to URLs on the same server, so the code of the PCIF applet must be on the same domain of the images it refers to in order to work. For problems in inserting the applet in a web page I suggest referring to the tuturial about the applet tag on java.sun.com.
When a PCIF applet is encountered in an HTML page, the browser will automatically download the classes of the program. Even if for a single image this could vanish part of the compression gain in respect, for example, to a PNG file, once the applet is loaded the browser will cache it making it available for the decompression of other images. Consequently from the decompression of the second image in PCIF format the only bandwidth occupation will be represented by the size on the PCIF image itself.
PCIF applet: JAR file
The Java Archive Resurce file containing all classes necessary for the PCIF applet to be executed in a web page. A sample code to use this file could be the following:
<applet codebase = "[Jar location]" archive = "[pcifapplet path]/pcfapplet.jar" code = "pcfapplet.pcfapplet.class" width = [Image width] height = [Image height]> <param name="image" value="[URL of PCIF file]"> </applet>
In the above you should replace the strings in square brackets with appropriate values.
PCIF applet: classes
This zip file contains all the classes necessary for the pcfapplet to run. In a web site it would be generally preferrable to use the JAR file as this would require a minor download time, beeing a compressed file. Anyway, using uncompressed classes may enhance compatibility with some older browsers. A sample of HTML code to include the applet in a web page could be:
<applet codebase = "[Jar location]" code = "pcfapplet.pcfapplet.class" width = [Image width] height = [Image height]> <param name="image" value="[URL of PCIF file]"> </applet>
As for the JAR sample HTML code, in the above you should replace the strings in square brackets with appropriate values. The only difference between the two samples is the 'archive' attribute in the previous code.
PCIF applet: sources
Zip file containing the Java sources for the PCIF applet. Apart from the file representing the applet itself (pcfapplet.java) the other files are the same than those used for the general program except for the fact that methods for compression have been removed. This has been done to create a smaller file to download when the applet has to be loaded in an HTML page.
For the documentation of the PCIF applet you can refer to the main documentation page of the whole project.