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

Raw image formats do not work

    Details

      Description

      Raw image formats are not processed by DAM properly.

      Test Case:
      1. Get a sample Nikon NEF file or Canon CR2 file (attached for convenient testing)
      SampleNikonRaw.NEF is 4256x2832
      SampleCanonRaw.CR2 is 3328x4992
      2. Import into DAM (regardless of method)

      Problem:
      No conversions or thumbnails are generated of any kind.
      (CR2 does actually generate previews but based on a bad extraction of the small embedded TIFF format with incorrect sizes)

      Error log info (relevant):
      ERROR [Nuxeo-Work-pictureViewsGeneration-1] [org.nuxeo.ecm.platform.picture.ImagingComponent] Failed to get ImageInfo for file SampleNikonRaw1.NEF
      org.nuxeo.ecm.platform.commandline.executor.api.CommandException: Error code 1 return by command: identify -define registry:temporary-path=#

      {java.io.tmpdir} -quiet -ping -format '%m %w %h %z %[colorspace]' #{inputFilePath}[0]identify: Incorrect count for "MakerNote"; tag ignored. `TIFFFetchNormalTag' @ error/tiff.c/TIFFErrors/552.TIFF 160 120 8 sRGBat
      org.nuxeo.ecm.platform.commandline.executor.api.ExecResult.<init>(ExecResult.java:60)at org.nuxeo.ecm.platform.commandline.executor.service.executors.ShellExecutor.exec(ShellExecutor.java:80)at org.nuxeo.ecm.platform.commandline.executor.service.CommandLineExecutorComponent.execCommand(CommandLineExecutorComponent.java:172)at org.nuxeo.ecm.platform.picture.magick.utils.ImageIdentifier.getIdentifyResult(ImageIdentifier.java:58)at org.nuxeo.ecm.platform.picture.magick.utils.ImageIdentifier.getInfo(ImageIdentifier.java:43)at org.nuxeo.ecm.platform.picture.ImagingComponent.getImageInfo(ImagingComponent.java:175)at

      Source of problem:
      Imagemagick commands, (identify, convert, stream) do not correctly identify raw images without extension.
      Work fine on raw with type prefix or filename extension, but with removal of extension return same errors as in logs.
      (Tested and verified on direct call of commands)
      These do work fine on other image formats and don't require extension or type prefix because of correct binary introspection
      Raw formats have embedded TIFF previews which ImageMagick erroneously treats as the main file, and subsequent metadata mismatches.

      Broken:
      identify -ping -format '%m %w %h %z %[colorspace]’ SampleNikonRaw1

      OK:
      identify -ping -format '%m %w %h %z %[colorspace]’ SampleNikonRaw.NEF
      or
      identify -ping -format '%m %w %h %z %[colorspace]’ NEF:SampleNikonRaw


      Suggested fix:

      1. Modify all MagickExecutor utility classes in org.nuxeo.ecm.platform.picture.magick.utils to include additional extension parameter.
      Ex.
      In ImageConverter:
      public static void convert(String inputFilePath, String inputFileExtension, String outputFilePath)

      In ImageIdentifier:
      public static ImageInfo getInfo(String inputFilePath, String inputFileExtension)

      2. Modify all callers of these classes to pass in extension
      Ex.
      In ImagingComponent.getImageInfo(Blob blob)
      ...
      try {
      String ext = blob.getFilename() == null ? ".tmp" : "." + FilenameUtils.getExtension(blob.getFilename());
      try (CloseableFile cf = blob.getCloseableFile(ext)) { imageInfo = ImageIdentifier.getInfo(cf.getFile().getCanonicalPath(), ext); }
      }
      ...

      3.
      Option 1:
      Modify Command extension parameter string to take additional named parameter of #{inputFileExtension} followed by colon as well as MagickExecutors to pass them in.
      Ex.
      <command enabled="true" name="identify">
      <commandLine>identify</commandLine>
      <parameterString>-define registry:temporary-path=#{java.io.tmpdir}

      -quiet -ping -format '%m %w %h %z %[colorspace]' #

      {inputFileExtension}:#{inputFilePath}[0]</parameterString>
      <winParameterString>-define registry:temporary-path=#{java.io.tmpdir} -quiet -ping -format "%m %w %h %z %[colorspace]" #{inputFileExtension}

      :#

      {inputFilePath}

      [0]</winParameterString>
      <installationDirective>You need to install ImageMagick.</installationDirective>
      </command>

      In ImageIdentifier:
      public static ExecResult getIdentifyResult(String inputFilePath, String inputFileExtension) throws CommandNotAvailable

      { CommandLineExecutorService cles = Framework.getLocalService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("inputFilePath", inputFilePath); params.addNamedParameter("inputFileExtension", inputFileExtension); return cles.execCommand("identify", params); }

      Option 2:
      Combine inputFileExtension with inputFilePath when passing to CommandLineExecutor. This wouldn't require modifying Command definition extensions.
      Ex.
      In ImageIdentifier:
      CmdParameters params = cles.getDefaultCmdParameters();
      params.addNamedParameter("inputFilePath", inputFileExtension + ":" + inputFilePath);
      return cles.execCommand("identify", params);

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.