final int SIZE= 16; // square images
ImageData data= image.getImageData();
Image copy;
if (data.height > SIZE || data.width > SIZE) {
// scale down to icon size
copy= new Image(Display.getCurrent(), data.scaledTo(SIZE, SIZE));
} else {
// don't scale up, but rather copy into the middle and mark everything else transparent
ImageData mask= data.getTransparencyMask();
ImageData resized= new ImageData(SIZE, SIZE, data.depth, data.palette);
ImageData resizedMask= new ImageData(SIZE, SIZE, mask.depth, mask.palette);