// (actually close to 0.5 it also looks jagged, so we use 0.575 instead)
// however, if the image is to big, "out of memory" issues may occur
int average = (width + height) / 2;
if ((factor < 5.0) && (average < 900)) {
// image is quite small and suitable factor - use gaussian blur
GaussianFilter gauss = new GaussianFilter();
double radius = Math.sqrt(2.0 * factor);
gauss.setRadius((float)radius);
image = gauss.filter(image, null);
} else {
// image is rather large, use much faster box blur
double root = Math.sqrt(factor);
int radius;
if (factor < 2.5) {