SourceForge Logo

GetPictures Applet Introduction

The Java Applet AWT Picture Browser allows anyone to set up and maintain an online gallery of images using no server scripting, and no JavaScript.GetPictures is being developed at sourceforge.

Try it at

GetPictures Applet screen snapshot (medium size)

The latest Java plug-in and JRE for your browser can be downloaded from sun and then installed according to the downloaded instructions. The web has millions of amazing Java applets so it is generally worth considering this download, but especially if your browser initially came without Java, or your Java Runtime Environment (JRE) has been superseded, or become noticeably buggy.


  1. Collect together all the photographs that you want to display and ensure they are in JPEG format
  2. Organise the JPEG images into folders/directories of between 4 and 40 photographs.
  3. Ensure that all the pictures are of a suitable visible size, quality and file size - see Image Size section.
  4. Name all the image directories with something short, clear and suitably sortable.
  5. Arrange all the image directories to be subdirectories of a single directory
  6. Copy that parent directory and all the subdirectories of images over to your webserver.
  7. Download the latest release of GetPictures.jar from the GetPictures SourceForge summary  page.
  8. Create a web page with an applet tag and customizethe applet parameters
  9. Copy the file GetPictures.jar and your applet containing web page to the appropriate directories on your web server
  10. Test and check all files are in their correct locations, check your web logs and Java console for errors.
  11. If website visitors are by default not allowed to see directory indexes, create a .htaccess file to allow indexes
  12. Tell someone where to look, because without direct HTML links to each of your pictures, you get a little more privacy and  should not be bothered by the web image spiders.

For more information on configuring your web server to allow directory indexes, see either apache documentation, or that from whichever webserver you use.

Image Size

Many digital cameras produce raw JPEG image files over 3MB by default - downloading a directory of such images would take hours over a slow connection and would consequently irritate and lose most of your audience. Most existing image editing programs like The Gimp offer interactive dialogues that enable you to choose the most appropriate compromise between file size and image quality. However, editing all your photographs by hand just to produce a copied set of lower file size is a waste of effort when other program scan automate this task for you. Apple Mac owners can use iPhoto which is free with Mac OS X, and everyone can use the Java application JPEGDirCopy from Jeremy Parsons. A good compromise between file size, quality, and the expected available screen space of a typical Web surfer would be to use an image size of 800 by 800 pixels and a JPEG quality level of 0.7 to give a typical file size of 70 KB though highly detailed photographs of forests, complex textures etc. would be around 100KB and sunsets or big blue skies around 30KB.

Oracle bought Sun and Java has grown so now there are a few versions of Java around and, unfortunately, the newest version of open java no longer support the deprecated com.sun classes including a fast JPEG image processing class which is used in getpictures so try older versions of open Java or Oracle's own JDK if you get problems.

Applet Parameters

An introduction to applets and a course teaching the important parts of the Java Abstract Windowing Toolkit AWT can be found at the  Sun Microsystems Java website.

To fit within Java's tight applet security sandbox, it is necessary to store all the JPEG images, and all the Java code on the same webserver as the HTML page containing the applet tag. For most people this is not a problem as they only use one webserver for all their web pages but it does preclude using this applet for viewing images really published by someone else on some other website. Furthermore, you cannot use one copy of GetPictures.jar from multiple web image servers, each must have its own copy.

The most important attribute of the applet tag is the archive attribute which specifies the location of the Applet Java Bytecode stored and compressed into the GetPictures.jar

<applet archive="" ...

The location of your online top-level folder of photograph folders is specified via the applet parameter "PictureDirectoryURL" as shown below:

<param  name="PictureDirectoryURL" value="">

Most URL's would typically be relative "../classes/GetPictures.jar" or "./picture_pages" to allow a website to be moved around easily

Technical Development

The  Java Applet Picture Viewer using AWT project aims to publish the existing JPEG image viewer applet started by Jeremy Parsons. The code should be portable, commented, and aims to provide a very flexible  client picture viewer. The applet has been written to use Java 1.1 libraries and the standard Abstract Windowing Toolkit from Sun Microsystems so bugs-permitting it is usable in any Java Runtime Environment.

The Java jars are ready for use immediately, but more testing and customisation would be useful.


The existing code uses throttled multithreaded downloads, minimizes its own memory usage, and can continue working after disconnection from a network. The server needs only to provide standard HTML web page indexes to give hierarchical access to the uploaded picture libraries which are just directories off JPEG files. There is no need for server side extensions, no perl, nor php.

The JPEG images are uploaded by the website administrator (usually by ftp) to a standard Web server as folders of *.jpg files. All the complicated download work of screen scraping, multithreaded image downloads, thumbnail
preparation, picture indexes and iterative slide shows is done in the existing Java 1.1 standard client code. 

Execution Options

# With a web browser or appletviewer for a full external example:

# These commands can be used to run the applet outside a browser

java -jar GetPictures.jar
java -cp GetPictures.jar com.jeremyparsons.imaging.GetPictures
appletviewer http://localhost/~jparsons/jparsons/personal/picture_viewer_applet.html
java -cp $PWD com.jeremyparsons.imaging.GetPictures http://localhost.localdomain/~jparsons/
java -cp $PWD com.jeremyparsons.imaging.GetPictures

# Internally with more memory and using my own apache web server configured to allow directory listings:

java -Xmx100M -cp $PWD com.jeremyparsons.imaging.GetPictures  http://localhost/~jparsons/jparsons/personal/picture_pages
jdb -classpath $PWD ... 
appletviewer -debug  ...

# or if running over X with > Java2 version 1.3, disable offscreen buffering

java -Dsun.java2d.pmoffscreen=false ...


Just type "make", or the jar files can be created with the following commands but see the Makefile or Ant for something better.

javac -O -d . *.java
jar cvf GetPictures.jar embl README
jar cvf GetPicturesSource.jar *.java *.html README docs Makefile
chmod a+r *.jar