Quantum Treemaps and Bubblemaps

for a Zoomable Image Browser

Benjamin B. Bederson

Human-Computer Interaction Laboratory

Computer Science Department, Institute for Advanced Computer Studies

University of Maryland, College Park, MD 20742

+1 301 405-2764





This paper describes two algorithms for laying out groups of objects in a 2D space-filling manner. Quantum Treemaps are a variation on existing treemap algorithms that are designed for laying out images or other objects of indivisible (quantum) size. They build on the Ordered Treemap algorithm, but guarantees that every generated rectangle will have a width and height that are an integral multiple of an input object size. Bubblemaps also fill space with groups of quantum-sized objects, but generate non-rectangular blobs, and utilize space more efficiently.

Both algorithms have been applied to PhotoMesa, an application that supports browsing of large numbers of images. PhotoMesa uses a Zoomable User Interface with a simple interaction designed for novices and family use.


Zoomable User Interfaces (ZUIs), Treemaps, Image Browsers, Animation, Graphics, Jazz.


There has been much work in recent years on information retrieval systems for multimedia, including systems concentrating on images. However, these systems focus on specifying queries or presenting results in a manner that helps users quickly find an item of interest. For image searches, in particular, there has been relatively little work on new interfaces, visualizations, and interaction techniques that support users in browsing images.

Image browsing is important for a number of reasons. First of all, no matter what information retrieval system is being used, the user has to browse the results of the search. It is certainly important to build query systems that help users get results that are as close to what is wanted as possible. But there will always be images that need to be browsed visually to make the final pick.

The second reason for needing new image browsers is more subtle, and was actually my primary motivation for doing the present work. Sometimes, people browse images just for the pleasure of looking at those images, and they often do it with other people. This is especially true for personal photos. As people take more digital family pictures, we need better tools to support users in home settings as they look at those pictures together on a computer screen. Looking at home photos has a lot of overlap with traditional retrieval systems. People still want to be able to find photos of particular people and events, etc. However, they are less likely to be time pressured to find a particular photo, and more likely to be interested in serendipity that is, finding photos they werent looking for [5].


Most image browsing systems present the images as a grid of thumbnails that the user can scroll through with a vertical scrollbar, and see a high resolution version of the image with some mouse interaction. Although there are a few alternatives such as manually constructed digital photo albums, and one commercial zoomable image browser.

I found that in my home life, I needed better tools to look at pictures with my two-year-old daughter. I did not want to spend the time to make custom albums. In addition, I found using traditional software with a grid of thumbnails, scrollbars, and popup viewer windows unpleasant in this context. I wanted to concentrate on the images and more importantly, as I was looking at the photos with my daughter, it was crucial that she be able to understand what was going on as I was controlling the mouse.

Motivated by the need of a tool that would support browsing of images with my family, I started to investigate techniques for presenting collections of images or other visual data. While much work has been done on visualizing complex datasets, surprisingly few techniques are available for presenting images. My goal was to come up with a mechanism that would be able to automatically layout groups of images in a way that would offer a simple interface to browse while giving access to a large set of images and their context.

I ended up developing two new algorithms, called Quantum Treemaps and Bubblemaps. Quantum Treemaps are a variation on existing treemap algorithms. Treemaps are a family of algorithms that partition two-dimensional space into regions that have an area proportional to a list of requested areas. The problem with existing treemap algorithms is that they all return areas of arbitrary aspect ratios. A requirement of photo display is that the regions that show groups of photos must have dimensions that are integer multiples of the dimensions of the photos that is, they must be sized to contain quantum, or indivisible contents. The use of treemaps to display images is the first known use of treemaps to display visual content, such as images, rather then just using the size and color of the rectangles to visualize two numerical attributes of a dataset.

Bubblemaps are generated with a grid-based recursive fill algorithm. They fill all the cells in a grid leaving almost no unused space, and generate groups of images that are approximately rectangular or circular.

In parallel, I developed PhotoMesa, an image browsing application that uses these layout algorithms, demonstrating the effectiveness of their approach and satisfying my need for a comfortable image browsing tool. PhotoMesa organizes images in a two-dimensional grid, where images with a shared attribute (such as directory location, nearness in time, or a shared word in their filename) are grouped together (Figure 1). It uses zooming as the primary presentation mechanism, and simple interaction techniques have been developed to make navigation straight-forward, and to eliminate the possibility of getting lost.

This paper describes the Quantum Treemap and Bubblemap algorithms, and illustrates their use with PhotoMesa. All the software described in this paper is written in Java 2, and is fully functioning as described, and is available at the URL in the title of this paper.



As previously mentioned, the standard way to let users browse a set of images is with a grid of thumbnails with a vertical scrollbar. Clicking on an image usually brings up a window with the high-resolution version of the image. The user then has to manually manage the open windows, and close them when they are no longer needed. One good commercial example of this approach is ACDSee which offers a clean interface and fast interaction [1].

This approach has been extended by a research group at the University of Maryland developing PhotoFinder [15, 21]. It lets users organize photos into collections which are displayed with a representative image that the user selects. The interface first shows collections, and selecting a collection displays a traditional grid of thumbnails. PhotoFinder does avoid the problem of window management, however, by displaying high-resolution photos in a pane within the interface. PhotoFinder concentrates on interfaces for managing and searching a database of meta information, but the browsing interface is essentially a polished traditional approach.

Document Lens is a technique that uses 2D fisheye distortion to present a grid of thumbnails of documents with a mechanism to zoom one document up to a readable size in place [17]. Document Lens, however, visualizes just a single collection of objects at a time.

Others have looked into automated algorithms for clustering semantically related information, and presenting the results visually. Hascot-Zizi and Pediotakis built such a system for a digital library retrieval system, showing the available thesaurus as well as results of searches [13]. Platt has built a system for automatically clustering photos, and extracting representative photos for each cluster [16].

Several groups have investigated applications of images for story telling or sharing in the home. The Personal Digital Historian project at MERL is building a circular display on a tabletop intended for several people to interact with images together. The design includes search by several kinds of metadata, but the mechanism for interacting with many images was not described in detail [19].

A group at Ricoh is building a dedicated portable story-telling device based on the construction of sequences of images. It has a dedicated hardware interface for selecting sequences of images which can then be annotated with audio, and played back when telling the story associated with those images [5].

For a pure software approach, we and others have built Zoomable User Interfaces (ZUIs) for image browsing. ZUIs are interfaces that present information on a large flat space where the user can smoothly zoom into the space to see information in more detail, or zoom out to get an overview. ZUIs have the potential advantages that they are easy to comprehend, and they give a consistent and easy to use interface for getting an overview of the information, and seeing more detail.

The author of this paper helped build an earlier ZUI-based image browser called ZIB (Zoomable Image Browser) [10]. ZIB combined a zoomable presentation of a grid of images with a search engine (that searched metadata), and a history mechanism to access previous searches. However, ZIB provided access to only a single group of images, and used manual zooming which was difficult to use.

The approach started in ZIB was continued in a new project that is creating an interface for elementary school-aged children to find multimedia information in a digital library [11]. This project, called SearchKids, presents visual results in a zoomable interface with a simpler interaction mechanism that PhotoMesa is based on.

Another ZUI-based image browser is currently available commercially by Canon, and is called ZoomBrowser EX [2]. The Canon browser presents a hierarchy of images (either manually constructed, or imported from a disk hierarchy) with containment. The top level shows a grid of squares, each of which contain a grid of image thumbnails and/or smaller squares that show more thumbnails, etc. It uses a layout very similar to what we used earlier in the Pad++ directory browser [7]. This layout has the disadvantage that all directories are the same size, and the contents are scaled to fit so that images in large directories are scaled small so as to be unreadable.

The interaction is to click on a square, and the contents of the square are smoothly zoomed into. Clicking on an image brings up a traditional high-resolution image viewer in a separate window. Clicking on a special zoom-out button zooms out to the next level in the hierarchy. There is also a magnification mode which zooms in a fixed amount each click, rather than zooming into the next level of the hierarchy.

Another aspect of image browsing is what the order of presentation of images should be. Rodden, et al. examined how presentation order of images affected designers abilities to select interesting images from a larger set of images arranged in a grid [18]. They compared random order to an order based on content similarity, and to visual similarity. This study showed that designers liked a range of organization mechanisms. Placing images that were visually similar near each other wasnt always best because images with similar colors tended to be less distinguishable when near each other. This approach does motivate the importance of grouping images by content, but the utility of this approach clearly depends on the users and their tasks.


To demonstrate the effectiveness of our new layout algorithms, I describe PhotoMesa, a standalone application that supports browsing of large sets of images. It allows the user to view multiple directories of images in a zoomable environment, and uses a set of simple navigation mechanisms to move through the space of images. It also supports clustering of images by metadata available from the file system. It requires only a set of images on disk, and does not require the user to add any metadata, or manipulate the images at all before browsing, thus making it easy to get started with existing images.

PhotoMesa is written entirely in Java 2, and is built using the Jazz framework for Zoomable User Interfaces [8]. The name PhotoMesa derives from the Spanish word mesa which means table, but is commonly used in the US southwestern states to describe the natural volcanic plateaus which are high and have flat tops. Standing atop a mesa, you can see the entire valley below, much as you can see an overview of many photos in PhotoMesa.

To start using PhotoMesa, a user opens a directory, or a set of directories, and PhotoMesa lays out the directories of images in a space-filling manner as shown in Figure 1. Even though a hierarchical directory structure is read in, the images are displayed in flattened, non-hierarchical manner. The rationale for this is that users looking at images are primarily interested in groups of photos, not at the structure of the groups. In addition, the interface for presenting and managing hierarchies of groups would become more complicated, and simplicity was one of the goals of the PhotoMesa.

As the user moves the mouse, the directory the mouse is over is highlighted, and the label is shown in full (it may have been clipped if there wasnt room to display the full label). Then when the user clicks, the view is smoothly zoomed in to that directory (Figure 2). Now, a highlight showing a set of images under the mouse lets the user know which images will be focused on when the mouse is clicked again. The number of images highlighted varies, but is enough to fill about a half of the screen so that the user will be able to quickly drill down to a full-resolution single image. At any point, the user can press the right button (or Enter key) to zoom out to the previous magnification. In addition, the user can double-click on an image to zoom all the way into that image and avoid intermediate zoom levels, or the user can double-right click to zoom all the way out to the top level.

The user can also press alt-left/right arrows to move back and forth in their history of views. Or, they can press the arrow keys to pan up, down, left or right. When zoomed all the way into a full-resolution image, the arrow keys stay within the current group of images, wrapping as necessary. When zoomed out so more than one image is visible, the arrow keys move across directories to let the user explore the entire space.

At all times, if the cursor is left to dwell over an image thumbnail for a short time, that thumbnail is zoomed up until it is 200 pixels wide. This preview is immediately removed whenever the mouse is moved.

While it is not necessary for users to do any authoring to browse images with PhotoMesa, they are allowed to change the color of image groups (although group background colors are assigned by default). This can make it easier to make sense of the large display of images since the colored areas can act as landmarks which are known to be effective navigation aids [14].

PhotoMesa supports drag-and-drop to let users directly export images to email, or other applications. Since emailing photos is a significant use mode, PhotoMesa automatically reduces the resolution and quality of images when they are dragged out of PhotoMesa (where the resulting resolution is controllable by the user). This eliminates the need to go through a special processing step when emailing images.

While the support of browsing is the primary goal of PhotoMesa, it is also sometimes desirable to find images in a specific directory, and it can be difficult to scan labels in a 2D space. So, a search pane on the left side is available that shows all the directories in order. Mousing over a label highlights the corresponding group of images, and clicking on a label zooms into that group. In addition, the search pane has a search box where users can search for images by words in their filename.

After PhotoMesa was built, and we started using it to browse directories of images, I realized that another way of thinking about what PhotoMesa was doing was presenting a large set of images clustered by directory. So I then added support for clustering by other data. Since I didnt want to require users to add metadata, PhotoMesa just uses whatever data is already available in the file system, which is just file date and name. If a user selects view by year, PhotoMesa groups all the currently opened photos by year, and creates a layout with one region per year. It does the same thing for viewing by month.

A more interesting clustering technique takes advantage of the fact that people frequently give meaningful filenames to their images, often with several words per image to describe the contents of the image. If a user selects view by filename words, it parses the filenames of all of the open images, and creates one cluster for each unique word in a filename (as tokenized with all the standard delimiters and where filename extensions and numeric tokens are ignored). Thus, if an image has 3 words in its filename (such as ben-eats-cake), then that image will appear in 3 clusters (one for ben, one for eats, and one for cake) (Figure 3).


PhotoMesa computes multiple sized thumbnails for each image, and dynamically loads the appropriate one. In this manner, it maintains good performance, even with large numbers of images. The thumbnails are created the first time an image is loaded, and cached in a special directory managed by PhotoMesa.

The design of PhotoMesa presents an inherent difference compared to traditional scrolling thumbnail grids. The traditional approach has the advantage that is searchable by navigating in one dimension (through vertical scrolling), while PhotoMesa requires navigation in two dimensions, which is typically harder for users. However, PhotoMesa has the advantage that the user can easily get an overview by zooming out. Through this interaction, the user can control the trade-off between the number of images shown and their resolution. This difference is a direct effect of the zooming nature of PhotoMesa. If a vertically oriented grid of thumbnails were zoomed out, the space would be mostly unused on either side of the linear list, and the display space would thus be largely wasted. Thus, it seems that a zoomable interface and 1D displays of data are inherently incompatible.


Treemaps are a family of algorithms that are space-filling partitions of a two-dimensional area. Treemaps take as input, a list of n numbers and a rectangle. They partition the area into n rectangles, one per input number. The rectangles are guaranteed to fill the input rectangle, and the rectangles are proportional in area to the list of input numbers. Treemaps are designed to be applied hierarchically, so any given resulting rectangle can itself contain a treemap, and so on, recursively.

There are two additional properties that some treemap algorithms have: order and aspect ratios close to 1 (i.e., rectangles that are close to squares). Here, and for the rest of the paper, aspect ratio is defined as max((width / height), (height / width)), so that an aspect ratio of 1 is perfectly square, and aspect ratios larger than one are more rectangular. Order is important to make it easier for users to find items in the treemap display. In addition, ordered displays make it easier to track items if they change over time since in an ordered display, each item will stay in approximately the same place on the screen. Rectangles with aspect ratios close to 1 are desirable because, generally speaking, they are more visually attractive. In addition, humans seem to be able to estimate the area of a square more accurately than a skinny rectangle, and one of the goals of treemaps is to use the area of each rectangle to present some useful attribute. Until recently, there were no algorithms that provided both properties.

The original treemap algorithm by Shneiderman [20] used a simple slice and dice approach. It divided the input rectangle into a single horizontal or vertical list of rectangles each one typically being quite skinny. If the algorithm was applied recursively, the sub-rectangle would be split in the opposite orientation as the parent. This algorithm did generate ordered rectangles, but they typically had extreme aspect ratios.

An important ensuing treemap algorithm, called Squarified Treemaps, gave up on ordering, but created much squarer rectangles [9]. Squarified Treemaps work by recursively dividing the space in two, and laying out some of the rectangle in one part, and the rest of the rectangles in the other part, where the list of rectangles is split based on optimizing the resulting aspect ratios. A variation of this algorithm was independently developed for SmartMoneys MarketMap applet [4]. Recently, Shneiderman and Wattenberg introduced Ordered Treemaps [22] which offer a compromise solution where the resulting rectangles are ordered, and somewhat squarified, but do not have as good aspect ratios as those generated by Squarified Treemaps. Other approaches to space-filling algorithms have been considered but they typically do not have all the nice properties of treemaps, such as that by Harel and Yashchin [12] which does not assign the size of the rectangles to any independent variable.

Treemaps have been applied to a number of domains, from visualizing hard disk usage [3] to the stock market [4]. However, in every current usage of treemaps to date, they are used to visualize a two-dimensional dataset where typically, one dimension is mapped to the area of the rectangles (as computed by the treemap algorithm), and the other dimension is mapped to the color of the rectangle. Then, a label is placed in the rectangles which are large enough to accommodate them, and the user can interact with the treemap to get more information about the objects depicted by the rectangles.

Surprisingly enough, there are not any published uses of treemaps where other information is placed in the rectangles. PhotoMesa appears to be the first application to put images within the area of each treemap rectangle.

There is a good reason why treemaps have not been used in this manner before. This is because while treemaps guarantee that the area of each generated rectangle is proportional to an input number, they do not make any promise about the aspect ratio of the rectangles. Some treemap algorithms (such as squarified treemaps) do generate rectangles with better aspect ratios, but the rectangles can have any aspect ratio. While this is fine for general purpose visualizations, it is not appropriate for laying out images because images have fixed aspect ratios, and they do not fit well in rectangles with inappropriate aspect ratios.

Let us look at the problem of applying existing treemap algorithms to laying out fixed size objects, such as images. For now, let us assume without loss of generality that the images are all square (i.e., having an aspect ratio of 1). We will see later that this does not affect layout issues. Given a list of groups of images that we want to lay out, the obvious input to the treemap algorithm is the number of images in each group. The treemap algorithm will generate a list of rectangles, and then we just have to decide how to fit each group of images in the corresponding rectangle.

For each rectangle and group of images, the first step is to decide on the dimensions of a grid with which to lay out the images in the rectangle. Given the aspect ratio of the rectangle, we compute the number of rows and columns that best fit the images.

The resulting grid may have more spots than there are images, but will not have too many rows or columns. This layout, however, is not guaranteed to fit in the rectangle. For example, consider a rectangle that was computed to hold a single image. It will have an area of 1.0, but could be long and skinny, perhaps with a width of 10.0 and a height of 0.1. The obvious solution is to scale down the images just enough to fit in the bounds of the rectangle.

Herein lies the problem. Since each group of images has to fit in to a separate rectangle, each group of images will have to potentially be scaled down. This will result in each group of images being a different size. Furthermore, since the rectangles are arbitrarily sized and positioned, and the images are scaled, the resulting groups of images will not align with each other in a visually attractive way.

It is standard graphic design practice to align content in a way that makes it easy for the eye to quickly scan different areas. If each group of images is a different size and they are not aligned, this will make the resulting layout less attractive, and may make it slower for a user to quickly scan. See Figure 5 for the result of laying out a simple sequence of images using the Ordered Treemap and Quantum Treemap algorithms to see the difference in overall layout. Note how showing the results of the Ordered Treemap, group #4 consisting of a single image is scaled much smaller than the other images. Showing the results of the Quantum Treemap algorithm, all images are the same size, and all images are aligned on a single grid across all the groups.

Ordered Treemaps

To understand the Quantum Treemap algorithm, it is necessary to first understand the basics of the Ordered Treemap algorithm because the former is a direct modification of the latter.

The Ordered Treemap algorithm, as with all treemap algorithms, take as input and produces output:



An ordered sequence of numbers that specify the size of the resulting rectangles.



A box to layout out the rectangles within.



An ordered sequence of rectangles that completely fill Box, and where the area of Ri is proportional to Li.

The algorithm is similar to QuickSort. It chooses a pivot, LP, and places it in Box. It then recursively lays out L1LP‑1 on one side of the pivot, and LP+1Ln on the other side of the pivot. Figure 4 shows the basic visual strategy for a horizontal layout. A corresponding approach is used for a vertical layout.

The Ordered Treemap algorithm is described in detail in [22], and is summarized here.

  1. If n == 1, then return a rectangle R = Box and stop.
  2. Choose a pivot element, RP. Pivot selection strategies include picking the middle element or the largest one.
  3. Calculate R1 so that its height fills Box, and so that its width is large enough to contain LA = L1LP‑1.
  4. Split LP+1Ln into two sublists, LB and LC that will be layed out in R2 and R3. Calculate where the splitting point is so that RP has an aspect ratio closest to 1.
  5. Calculate RP, R2 and R3. This is performed by using the ratio between the size of the corresponding lists, and breaking up the available space by the same ratios.
  6. Recursively apply the Ordered Treemap algorithm to LA in R1, LB in R2, and LC in R3.

This algorithm results in rectangles that are fairly square, and are ordered approximately left to right (or top to bottom in a vertically oriented box).

Quantum Treemap Algorithm

The goal of the Quantum Treemap algorithm is similar to other treemap algorithms, but instead of generating rectangles of arbitrary aspect ratios, it generates rectangles with widths and heights that are integer multiples of a given elemental size. In this manner, it always generates rectangles in which a grid of elements of the same size can be layed out. Furthermore, all the grids of elements will align perfectly with rows and columns of elements running across the entire series of rectangles. It is this basic element size that can not be made any smaller that led to the name of Quantum Treemaps.

The Quantum Treemap (QT) algorithm is based directly on the Ordered Treemap (OT) algorithm. However, the basic approach could be applied to any other treemap algorithm, such as the Squarified Treemap algorithm, resulting in a quantified version of that. QTs input and output are similar to those of OT, but instead of returning a set of rectangles that precisely fill the specified input Box, it generates a set of rectangles that only approximate the input Box. Because there is some wasted space, the resulting set of rectangles are usually larger than Box, but have close to the same aspect ratio. In addition, QT takes an additional input parameter which is the aspect ratio of the elements to be layed out in Box.

QT starts in exactly the same manner as OT, picking a pivot, subdividing the space, and recursively applying the algorithm to each sub-space. It works in the same way all the way down until step 1 of OT, the stopping condition.

At this point (step 1), rather then just unwinding the recursive stack, it adjusts the computed rectangle by modifying its dimensions, making it big enough for precisely the specified number of elements.

Then, as the recursion unwinds, the caller must accommodate the generated rectangles which may not fit precisely into the box that was asked for. This is the tricky part, and is captured in a modified version of step 6. Since the rectangles generated by the recursive call may be bigger or smaller in either dimension than was asked for, the rectangles from the other regions must be moved so they dont overlap, and possibly grown so they align nicely with neighboring rectangles. As an example, see Figure 5 (right). Rectangle #4 was originally computed to have dimensions (1x1), but since Rectangle #3 was much taller, Rectangle #4 was stretched to be 4 units tall to match the height of Rectangle #3. Similarly, Rectangle #1 was stretched to match the height of Rectangle #2. The new algorithmic steps are stated here:

new 1.       If n == 1, then compute a rectangle R that contains exactly L quantums in a grid arrangement that has an aspect ratio as close as possible to that of Box and stop.

new 6.       Recursively apply the Ordered Treemap algorithm to LA in R1, LB in R2, and LC in R3.

new 6a.    Translate the rectangles in RP, R2, and R3 to avoid overlapping R1 or each other.

new 6b.    Even out the rectangles in the sub-regions in the following manner. Make sure that RP and R2 have the same width. Make sure that RP and R2 together have the same height as R1. Make sure that R3 has the same height as R1. Each of these evening steps can be accomplished similarly by finding if one of the regions is too small. Then if it is not wide enough, add the extra amount to the width of the rectangles in that region that touch the right boundary of the region. Do the analogous action to rectangles not tall enough.

Element Aspect Ratio Issues

QT does assume that all elements that will be layed out in the rectangles produced by QT are the same aspect ratio, and that aspect ratio is an input parameter to QT. It turns out, however, that it is not necessary to modify the internal structure of QT to accommodate the elements aspect ratio. Instead, the dimensions of the starting box can simply be stretched by the inverse of the element aspect ratio. Simply put, laying out wide objects in a wide box is the same as laying out thin objects in a thin box.

Growing Horizontally or Vertically

In step 1, the requested rectangle may be grown to accommodate the quantum element size. There is a basic question of whether to grow this rectangle horizontally or vertically. The simple answer is just to grow in the direction that results in a rectangle that most closely matches the aspect ratio of the original rectangle. However, the algorithm as a whole produces better layouts if it always grows horizontally (or vertically for layout boxes that are oriented vertically).

The issue here is somewhat subtle, but is related to step 6b where the rectangles are evened. If, for example, rectangles in R3 are made taller, than all of R1 and R2 will have to made taller as well to match R3. If instead, the rectangles in R3 are made wider, than only the other rectangles in R3 will need to be made wider, and the rectangles in R1 and R2 can be left alone. In general, the evening aspect of the QT algorithm remains somewhat problematic. While it does work well for most data sets, it does occasionally yield undesirable layouts due to too much wasted space. This can happen when one region ends up growing a fair amount to accommodate data that doesnt happen to fit the starting rectangles, and then the other regions have to be grown to match. When these other regions are grown to match, the resulting rectangles are bigger than necessary, and there is wasted space. This doesnt seem to be a problem for datasets unless they contain many regions with a very small number of elements (< 10). In practice, it has not been a significant problem for the real image datasets we have viewed, although
sometimes there is a little more wasted space than we would like.

Stopping Condition Improvements

Changing the stopping conditions and offering special layouts for a small number of special cases can produce substantially better total results. The new stopping conditions apply equally to QT as well as to OT.

The basic improvement comes from the realization that the layout of rectangles depicted in Figure 5 does not necessarily give layouts with the best aspect ratios for 4 rectangles. In addition, it generates a layout that is somewhat difficult to parse visually because the eye has to move in 3 directions to focus on the 4 rectangles (horizontally from R1 to RP, vertically from RP to R2, and then horizontally from R2 to R3).


The layout can be improved, and visual readability by offering two alternative layouts. The first produces a quad of (2x2) rectangles. The second produces a snake layout with all 4 rectangles layed out sequentially either horizontally or vertically. The snake layout can be equally well applied to 2, 3, or more rectangles. PhotoMesa applied it up to 5 rectangles. Figure 6 shows the result of laying out a sequence of 4 groups of elements using the three strategies. The new algorithmic step is:

new 1a.    If n == 4, then first try the regular layout by continuing and letting the recursion get down to the bottom level

new 1b.    If n == 4, then layout the 4 groups in a quad. Split Box into two with either a horizontal or vertical split (depending on the orientation of Box) based on the number of elements in the 4 groups. Then, split each of the remaining boxes in two with the opposite orientation based on the number of elements in those 2 groups.

new 1c.    If n == 4, then layout the 4 groups in a snake by dividing Box into 4 sub boxes (horizontally or vertically, depending on the orientation of Box), based on the number of elements in the 4 groups.

new 1d.    Compute the aspect ratios and wasted space of the 4 resulting rectangles from steps 1a, 1b, and 1c, and use the layout with the best overall results.

Since no one layout strategy always gives the best result for all input data, for 5 or fewer rectangles, PhotoMesa computes layouts using all strategies (original, quad, and snake) and picks the best one. In practice, this strategy produces layouts with substantially squarer aspect ratios. Running 100 randomized tests with 100 rectangles, and random numbers of elements per rectangle, ranging from 10 to 1000 produced an average aspect ratio of 3.92 with the original stopping conditions, and 2.68 for the new stopping conditions.

Pivot Selection Improvement

In addition to the two pivot selection strategies discussed in [22], a third strategy specifically targeted at the evening

problem previously discussed offers improved results. The new strategy, called split size gives better results for some input data.

The basic approach is to pick the pivot that will split the lists of elements into equal sizes, or as close to equal as possible. With the sublists containing similar numbers of elements to lay out, there tends to be less evening, and therefore less wasted space. The new algorithmic step is:

new 2.       Choose a pivot element, RP. Pivot selection strategies include picking the middle element, the largest one, or the one that results in splitting the elements into lists that are as close to equal size as possible.

No single pivot selection strategy always works best, so in practice, PhotoMesa computes the layouts with all three pivot selection strategies, and picks the best one based on the average aspect ratios of the resulting rectangles, and the amount of wasted space.

Quantum Treemap Analysis

Figure 7: Average aspect ratio of all rectangles run on both algorithms
with 100 rectangles with random numbers of elements per rectangle.


One of the basic characteristics of QT is that it works better when there are more elements per group. This is because it gives the algorithm more flexibility when computing rectangles. A rectangle of, say, 1000 elements, can be arranged in quantified grids of many different sizes such as (30x34), (31x33), (32x32), etc. each of which use the space quite efficiently. Rectangles containing smaller numbers of elements, however, do not offer as many options, and often use space less efficiently. For example, a rectangle containing 5 elements can be layed out in (1x5), (2x3), (3x2), or (5x1). These four options do not give the algorithm as much flexibility as the dozens of grid options afforded by the larger number of elements.

In order to assess the effectiveness of QT, it was compared to OT with a series of trials using random input. Each algorithm was run 100 times generating 100 rectangles with the number of elements in each rectangle being randomly generated. This was done for 5 different ranges of the number of elements per rectangle. For each test, the average aspect ratio of all the rectangles was recorded as well as the space utilization, which was recorded as the percentage of space not used to display elements (wasted space). The same random numbers were used for each algorithm. Figures 7 and 8 show the results of these tests. Quantum Treemaps did better in terms of aspect ratio, and Ordered Treemaps did better in terms of wasted space.

However, the crucial visual advantage of QT is that it always produces layouts where elements are the same size and are aligned on a single global grid.


While Quantum Treemaps work well, they have the disadvantage of wasting some space. While it may be possible to improve the Quantum Treemap algorithm, it is impossible to layout images in a rectangle without leaving some unused space (in general) if the images are all the same size. An alternative approach is to give up on the idea that the space must be divided into rectangles, and instead allow more complex shapes.

Figure 8: Average wasted space as a percentage of the entire layout

space available. Tests run on both algorithms with 100 rectangles

with random numbers of elements per rectangle.

Bubblemap is a new algorithm which lays out groups of quantum-sized objects in an ordered position with no wasted space per group, although there is a small amount of wasted space for the entire area. The groups of objects can be created in different shapes, such as rectangular or circular, but the groups of objects only approximate those
shapes, rather than define them exactly. Figure 9 shows a rectangular and a circular Bubblemap layout of 10 groups of up to 200 rectangles per group. The Bubblemap algorithm has also been integrated into PhotoMesa as a user-selectable layout option. Figure 10 shows the Bubblemap algorithm applied to a set of images in PhotoMesa. There is no wasted space, but the regions have arbitrary shapes.

A more sophisticated approach to laying out related images in a grid has been pursued by Basalaj with his Proximity Grid algorithm [6]. It takes a set of objects with a high-dimensional set of relationships and generates a grid layout of those objects so that similar objects will be near each other on the grid. Bubblemaps, on the other hand, are much simpler and assumes the input is pre-clustered. They keep the clusters of images together, rather than optimizing an n-dimensional set of relationships.

The Bubblemap algorithm is completely different than the Treemap algorithm. Rather than subdividing rectangles, it is based on a standard pixel-based bucket fill algorithm. It works by filling in cells in a grid, keeping track of which cells get assigned to images from which group. It fills the cells one group at a time. By using different algorithms to select the next cell to fill, the shape of the groups can be controlled. The basic algorithm runs in O(n) time for n images. The basic algorithm follows:

Input: L1...Ln, Aspect Ratio

  1. Compute the size of the overall grid based on total number of images to layout, and the desired resulting aspect ratio.
  2. Create a grid of size computed from step 1, and set each cell to the value UNASSIGNED.
  3. For each group of images, Li, call the fill algorithm, starting at step 4, and then stop.
  4. Find the starting point to fill by looking for the first UNASSIGNED cell in the grid (in left-right, top-bottom order). Initialize a list of cells, called LIST, and add the starting point to LIST.
  5. If LIST is empty than stop. Else, take the first element, P, off of LIST, and set the cell at P's location to the value ASSIGNED.
  6. For each UNASSIGNED neighbor of P, Q, add Q to LIST, and set the cell at Q's location to the current group ID. GOTO 5. Note that the order in which the neighbors are added to LIST affect the shape of the resulting groups.

Bubblemaps are easy to implement, use space efficiently, and give ordered space-filling layouts like Treemaps do. However, since they produce arbitrary-shaped regions rather than rectangles, it is likely that users will find them harder to visually parse. So, while they may be appropriate for applications where the goal is simply to have related items near each other, they may well not be as appropriate for tasks where users need to clearly distinguish between groups.


I have used PhotoMesa regularly with my two year old daughter for nearly two months. We load in all of our family pictures (Figure 1) and sit together in front of a laptop computer. She will point at an area and I click and zoom in to it. I keep zooming in as she points at areas until we get all the way in to a single photo. I then zoom out one level, and if she asks to see another photo, I zoom into it. Otherwise, I zoom out another level until she sees something she is interested in. In this fashion, we look at the photos together, and she is able to stay in control and maintains a high level of interest. The zooming and smooth animation make it so that she is clearly able to follow what is going on, even though I operate the mouse.

In addition, 5 other members of our lab have used PhotoMesa for their personal or professional photos on PC and Mac environments. This is not a controlled study, but has been informative nevertheless. After using PhotoMesa for two weeks, I interviewed them and received uniformly positive feedback. One designer used it as a disk mapper to find out what was on her disk. Others reported liking the ability to see an overview of many groups of pictures coupled with the easy mechanisms for navigating.


This paper presents two new algorithms for laying out groups of images or other fixed-size visual objects. The algorithms were applied in an image browser program that demonstrates the effectiveness of this approach. Early use shows the layouts and PhotoMesa to be promising, but further evaluation is needed.

Future Work

The Quantum Treemap algorithm could be improved by reducing the amount of wasted space. It also would be useful to consider approaches that support internal padding per group. It may also be worth applying the quantum approach to the Squarified Treemap algorithm [9], and compare that to the current implementation.

The PhotoMesa application has a long To-Do list of features to be added. An important one is to integrate it with PhotoFinder to complement that project which concentrates on photo annotation and searching. Another area to look into is integration with the Web. The zoomable characteristics of PhotoMesa make it a good match with the Web, offering a potentially efficient manner to browse large image databases on the Web since only the resolution needed for the current view needs to be sent to the client. And of course, a detailed user study is needed to understand how the zoomable interaction of PhotoMesa compares to more traditional approaches.


I appreciate the feedback on PhotoMesa by many HCIL members. In particular, thanks to Jesse Grosjean who suggested the approach taken in the Bubblemap algorithm. In addition, I thank Ben Shneiderman for suggesting the interactive textual list of groups, to Allison Druin for suggesting the ability to color groups, to Jon Meyer and Catherine Plaisant for advise on the visual design of PhotoMesa, to Matthias Mayer for first suggesting I try to display several directories of images at once, and to Mark Stefik from Xerox PARC for suggesting the magnified preview images.


[1] ACDSee (2001). http://www.acdsystems.com/english/ products/acdsee/acdsee-node.htm.

[2] Canon ZoomBrowser (2001). http://www.powershot.com/ powershot2/software/ps_pc_view.html.

[3] DiskMapper (2001). http://www.miclog.com/dmdesc.htm.

[4] SmartMoney MarketMap (2001). http://www.smartmoney. com/marketmap/.

[5] Balabanovic, M., Chu, L.L., & Wolff, G.J. (2000). Storytelling With Digital Photographs. In Proc. of Human Factors in Computing Systems (CHI 2000) ACM Press, pp. 564-571.

[6] Basalaj, W. (2000). Proximity Visualization of Abstract Data. Doctoral dissertation, University of Cambridge, Cambridge, England.

[7] Bederson, B. B., Hollan, J. D., Perlin, K., Meyer, J., Bacon, D., & Furnas, G. W. (1996). Pad++: A Zoomable Graphical Sketchpad for Exploring Alternate Interface Physics. Journal of Visual Languages and Computing, 7, pp. 3-31.

[8] Bederson, B. B., Meyer, J., & Good, L. (2000). Jazz: An Extensible Zoomable User Interface Graphics Toolkit in Java. In Proceedings of User Interface and Software Technology (UIST 2000) ACM Press, pp. 171-180.

[9] Bruls, M., Huizing, K., & van Wijk, J. J. (2000). Squarified Treemaps. In Proc. of Joint Eurographics and IEEE TCVG Symp. on Visualization (TCVG 2000) IEEE Press, pp. 33-42.

[10] Combs, T. T. A., & Bederson, B. B. (1999). Does Zooming Improve Image Browsing? In Proceedings of Digital Library (DL 99) New York: ACM, pp. 130-137.

[11] Druin, A., Bederson, B. B., Hourcade, J. P., Sherman, L., Revelle, G., Platner, M., & Weng, S. (2001). Designing a Digital Library for Young Children: An Intergenerational
Partnership. In Proceedings of Joint Conference on Digital Libraries (JCDL 2001) ACM Press, p. (in press).

[12] Harel, D., & Yashchin, G. (2000). An Algorithm for Blob Hierarchy Layout. In Proceedings of Advanced Visual Interfaces (AVI 2000) ACM Press, pp. 29-40.

[13] Hascot-Zizi, M., & Pediotakis, N. (1996). Visual Relevance Analysis. In Proceedings of International Conference on Digital Libraries (DL 96) ACM Press, pp. 54-62.

[14] Jul, S., & Furnas, G.W. (1998). Critical Zones in Desert Fog: Aids to Multiscale Navigation. In Proc. of User Interface and Software Technology (UIST 98) ACM Press, pp. 97-106.

[15] Kang, H., & Shneiderman, B. (2000). Visualization Methods for Personal Photo Collections Browsing and Searching in the PhotoFinder. In Proceedings of IEEE International Conference on Multimedia and Expo (ICME2000) New York: IEEE, pp. 1539-1542.

[16] Platt, J. (2000). AutoAlbum: Clustering Digital Photographs Using Probabalistic Model Merging. In Proceedings of IEEE Workshop on Content-based Access of Image and Video Libraries (CBAIVL-2000 ) IEEE Press,

[17] Robertson, G. G., & Mackinlay, J. D. (1993). The Document Lens. In Proceedings of User Interface and Software Technology (UIST 93) ACM Press, pp. 101-108.

[18] Rodden, K., Basalaj, W., Sinclair, D., & Wood, K. (2001). Does Organisation by Similarity Assist Image Browsing. In Proceedings of Human Factors in Computing Systems (CHI 2001) ACM Press, pp. 190-197.

[19] Shen, C., Moghaddam, B., Lesh, N., & Beardsley, P. (2001). Personal Digital Historian: User Interface Design. In Proceedings of Extended Abstracts of Human Factors in Computing Systems (CHI 2001) ACM Press,

[20] Shneiderman, B. (1992). Tree Visualization With Treemaps: A 2-D Space-Filling Approach. ACM Transactions on Graphics, 11(1), pp. 92-99.

[21] Shneiderman, B., & Kang, H. (2000). Direct Annotation: A Drag-and-Drop Strategy for Labeling Photos. In Proceedings of IEEE Conference on Information Visualization (IV2000) New York: IEEE, pp. 88-98.

[22] Shneiderman, B., & Wattenberg, M. (2001). Ordered Treemap Layouts. Tech Report CS-TR-4237, Computer Science Dept., University of Maryland, College Park, MD.