ICEpdf
  1. ICEpdf
  2. PDF-631

Addition of smooth scaling algorithm to ImageReferenceFactory

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.2
    • Fix Version/s: 5.0.3
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      any

      Description

      When an image is drawn by the ImageReference class there is a catch for Throwable, generally the only way to get to the catch is a out of memory error. A client submited a file that looked considerably better when rendering using a restricted memory which caused the catch clause to execute.

      In this catch clause the image is scaled in size using a very simple algorithm. The interesting thing about the scale is that it uses surprising little memory and the next call to paint generally executes correctly.

        Activity

        Patrick Corless created issue -
        Hide
        Patrick Corless added a comment -

        The algorithm is quite simple

        if (width > 1000 && width < 2000)

        { width = 1000; }

        else if (width > 2000)

        { width = 2000; }

        scaledImage = image.getScaledInstance(
        width, -1, Image.SCALE_SMOOTH);

        But the net effect can be a significant reduction in memory consumption during the paint. I expect this algorithm to be improved over time.

        Show
        Patrick Corless added a comment - The algorithm is quite simple if (width > 1000 && width < 2000) { width = 1000; } else if (width > 2000) { width = 2000; } scaledImage = image.getScaledInstance( width, -1, Image.SCALE_SMOOTH); But the net effect can be a significant reduction in memory consumption during the paint. I expect this algorithm to be improved over time.
        Patrick Corless made changes -
        Field Original Value New Value
        Fix Version/s 5.0.3 [ 11070 ]
        Hide
        Patrick Corless added a comment -

        Update has been added to branch only at this point.

        Show
        Patrick Corless added a comment - Update has been added to branch only at this point.
        Patrick Corless made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37314 Tue Aug 06 15:07:08 MDT 2013 patrick.corless PDF-631 addition of new smoothScaled image scaling algorithm.
        Files Changed
        Commit graph MODIFY /icepdf/branches/icepdf-5.0.1/icepdf/core/src/org/icepdf/core/pobjects/graphics/ImageReferenceFactory.java
        Commit graph ADD /icepdf/branches/icepdf-5.0.1/icepdf/core/src/org/icepdf/core/pobjects/graphics/SmoothScaledImageReference.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37475 Wed Aug 21 13:01:07 MDT 2013 patrick.corless PDF-631 addition of new smoothScaled image scaling algorithm.
        Files Changed
        Commit graph ADD /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/graphics/SmoothScaledImageReference.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/graphics/ImageReferenceFactory.java
        Patrick Corless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: