Log.log(Log.TRACE, MODULE, "Executing " + cmdline.toString());
Log.log(Log.LEVEL_TRACE, MODULE, "Executing " + cmdline.toString());
	public static ImageIcon load( String filename, Dimension d, int usage ) {		ImageIcon r = null;		long start = System.currentTimeMillis();				if ( ! GalleryFileFilter.canManipulate(filename) ) {			return unrecognizedThumbnail;		}				if (useIM) {			try {				StringBuffer cmdline = new StringBuffer(imPath);				cmdline.append(" -size ").append(d.width).append("x").append(d.height);				if (filterName[usage] != null && filterName[usage].length() > 0) {					cmdline.append(" -filter ").append(filterName[usage]);				}								cmdline.append(" \"").append(filename).append("\"");				cmdline.append(" -resize \"").append(d.width).append("x").append(d.height).append("\"");				cmdline.append(" +profile \"*\" ");				File temp = File.createTempFile("thumb", "." + format[usage], tmpDir);				toDelete.add(temp);								cmdline.append("\"" +temp.getPath() + "\"");								Log.log(Log.TRACE, MODULE, "Executing " + cmdline.toString());							Process p = Runtime.getRuntime().exec(cmdline.toString());				int exitValue = p.waitFor();				Log.log(Log.TRACE, MODULE, "Returned with value " + exitValue);								if (exitValue != 0 && ! imIgnoreErrorCode) {					Log.log(Log.CRITICAL, MODULE, "ImageMagick doesn't seem to be working. Disabling");					useIM = false;				} else {					r = new ImageIcon(temp.getPath());				}			} catch (IOException e1) {				Log.logException(Log.ERROR, MODULE, e1);			} catch (InterruptedException e2) {				Log.logException(Log.ERROR, MODULE, e2);			}		}		if ( ! useIM && r == null ) {			r = new ImageIcon( filename );					Image scaled = null;			Dimension newD = getSizeKeepRatio(				new Dimension( r.getIconWidth(), r.getIconHeight() ),				d );			scaled = r.getImage().getScaledInstance( newD.width, newD.height, Image.SCALE_FAST );				r.getImage().flush();			r.setImage( scaled );		}		long time = System.currentTimeMillis() - start;		totalTime += time;		totalIter++;		Log.log(Log.TRACE, MODULE, "Time: " + time + " - Avg: " + (totalTime/totalIter) );		return r;	}