ICEpdf
  1. ICEpdf
  2. PDF-724

Investigate adding in the ImageScalr library

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 5.0.5
    • Fix Version/s: 5.0.6
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      All

      Description

      Feature Request: Look into adding in the ImageScalr library to help improve rendering performance.

        Activity

        Hide
        Stefan Franz added a comment -

        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

        Show
        Stefan Franz added a comment - 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
        Hide
        Patrick Corless added a comment -

        The method above is very similar to the "scaled" image reference mode. I'm hesitant to change the behavior of the current implementation of "smoothScaled" . Creating a new ImageReference implementation but be an option here.

        Show
        Patrick Corless added a comment - The method above is very similar to the "scaled" image reference mode. I'm hesitant to change the behavior of the current implementation of "smoothScaled" . Creating a new ImageReference implementation but be an option here.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Arran Mccullough
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: