Hi Patrick,
We did another research and tried to find a way to boost the rendering speed without using ImageScalr library. We found out that ImageScalr is doing nothing else then waive the interpolation and iterative scaling you use in the getTrilinearScaledInstance() method. After we tried to do so in that particular method we get the same results in terms of rendering speed as we get with ImageScalr. Our method looks now like this:
/**
- @param img image to scale
- @param targetWidth target width
- @param targetHeight target height
- @return scaled instance.
*/
public static Image getTrilinearScaledInstance(BufferedImage img, int targetWidth, int targetHeight)
{
Object hint = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
int type = (img.getTransparency() == Transparency.OPAQUE) ?
BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
img = scaleImage(img, type, hint, targetWidth, targetHeight);
return img;
}
Are there any doubts concerning this approach? Could it be useful to put it in the regular codebase of ICEpdf?
Sunny greetings from Germany
Stefan
Hi Patrick,
We did another research and tried to find a way to boost the rendering speed without using ImageScalr library. We found out that ImageScalr is doing nothing else then waive the interpolation and iterative scaling you use in the getTrilinearScaledInstance() method. After we tried to do so in that particular method we get the same results in terms of rendering speed as we get with ImageScalr. Our method looks now like this:
/**
*/
public static Image getTrilinearScaledInstance(BufferedImage img, int targetWidth, int targetHeight) { Object hint = RenderingHints.VALUE_INTERPOLATION_BILINEAR; int type = (img.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; img = scaleImage(img, type, hint, targetWidth, targetHeight); return img; }
Are there any doubts concerning this approach? Could it be useful to put it in the regular codebase of ICEpdf?
Sunny greetings from Germany
Stefan