// Load the input image.
if (ip == null) {
return false;
}
ip = new ImagePlus(ip.getTitle(), ip.getImageStack());
ImageProcessor processor = ip.getProcessor();
if(square) {
processor = processor.resize(size, size);
} else if (ip.getWidth() > ip.getHeight()) {
processor = processor.resize(size, ip.getHeight()*size/ip.getWidth());
} else {
processor = processor.resize(ip.getWidth()*size/ip.getHeight(), size);
}
ip.setProcessor(null,processor);
int type = ((ImageJImage) iw).getImageType();
return ImageProcess.save(type, ip, outputFile);