Setting the RenderingHints KEY_INTERPOLATION to BILINEAR or BICUBIC produces the
exact same output, as illustrated by the following code segment. Test has been run with several types of images, from graphics (e.g. Duke image) to photos.
BufferedImage bilinear = new BufferedImage(2*w, 2*h,
BufferedImage.TYPE_INT_RGB);
BufferedImage bicubic = new BufferedImage(2*w, 2*h,
BufferedImage.TYPE_INT_RGB);
Graphics2D bg = bilinear.createGraphics();
bg.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
bg.scale(2, 2);
bg.drawImage(duke, 0, 0, null);
bg.dispose();
bg = bicubic.createGraphics();
bg.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
bg.scale(2, 2);
bg.drawImage(duke, 0, 0, null);
bg.dispose();
for(int i=0; i<2*w; i++)
for(int j=0; j<2*h; j++)
if(bilinear.getRGB(i, j) != bicubic.getRGB(i, j))
System.out.println("Interpolation algo differ");