Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-20988

Fix handling of multilayered pictures

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not A Bug
    • Affects Version/s: 7.10
    • Fix Version/s: 7.10-HF18, 8.10
    • Component/s: Preview

      Description

      Currently the commands defined here only converts the first layer of multilayered pictures.
      This is probably due to the fact most pictures contain a flattened version on the layer 0.
      It seems some files have an incompatible layer 0 with the -flatten options and thus only a part of the picture is converted (see attached compressed psd file), the background color is applied.

      Workaround: instead of using the default

      <command name="jpegResizer" enabled="true">
            <commandLine>convert</commandLine>
            <parameterString>-define registry:temporary-path=#{nuxeo.tmp.dir} -quiet -background white -flatten -depth #{targetDepth} #{inputFilePath}[0] jpg:- | convert - -resize #{targetWidth}x#{targetHeight} #{outputFilePath}</parameterString>
            <winParameterString>-define registry:temporary-path=#{nuxeo.tmp.dir} -quiet -background white -flatten -depth #{targetDepth} #{inputFilePath}[0] -resize #{targetWidth}x#{targetHeight} #{outputFilePath}</winParameterString>
            <installationDirective>You need to install ImageMagick.</installationDirective>
          </command>
      

      One could use the following:

          <command name="jpegResizer" enabled="true">
            <commandLine>convert</commandLine>
            <parameterString>-layers merge -define registry:temporary-path=#{java.io.tmpdir} -quiet -background white -flatten -depth #{targetDepth} #{inputFilePath} jpg:- | convert - -resize #{targetWidth}x#{targetHeight} #{outputFilePath}</parameterString>
            <winParameterString>-layers merge -define registry:temporary-path=#{java.io.tmpdir} -quiet -background white -flatten -depth #{targetDepth} #{inputFilePath} -resize #{targetWidth}x#{targetHeight} #{outputFilePath}</winParameterString>
            <installationDirective>You need to install ImageMagick.</installationDirective>
          </command>
      

      This results in proper generation of thumbnails and preview for example at the expense of added computing but should work with any multilayered file.

        Attachments

        1. psdFile.7z
          10.54 MB
        2. speedTest.sh
          0.5 kB

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h