Page 1 of 2

Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-15T02:51:10-07:00
by aureld
Hi guys,

It is the first time I use Imagick so please be patient ;)
I need to automatically convert PSD files with or without multiple layers into a TIFF LZW with only one layer, without noticeable differences.

Here is type of command I tried with Imagemagick 6.9.2-7 :

convert "fontaine_p7p.psd" -compress LZW -define tiff:endian=msb -background none -flatten fontaine_p7p.tif

Result is not as expected compare to the one obtained thanks to PhotoShop.
Layers are correctly merged, sizes of conversions are equivalent but I can see visible modifications on the Imagemagick tiff that are not visible on tiff generated thanks to PhotoShop.

Here are examples of a source PSD and the Tiff obtained via the imagemagick conversion above and where visible modifications appears (particularly in water transparency) :
https://drive.google.com/file/d/0ByRmRq ... sp=sharing

Here are details on PSD and TIFF files :

PSD :

identify fontaine_p7p.psd
fontaine_p7p.psd[0] PSD 782x819 782x819+0+0 8-bit CMYK 2.965MB 0.000u 0:00.000
fontaine_p7p.psd[1] PSD 544x819 544x819+226+0 8-bit CMYK 2.965MB 0.000u 0:00.000
fontaine_p7p.psd[2] PSD 335x819 335x819+447+0 8-bit CMYK 2.965MB 0.000u 0:00.000
fontaine_p7p.psd[3] PSD 782x13 782x13+0+806 8-bit CMYK 2.965MB 0.000u 0:00.000
fontaine_p7p.psd[4] PSD 782x819 782x819+0+0 8-bit CMYK 2.965MB 0.000u 0:00.000
fontaine_p7p.psd[5] PSD 782x819 782x819+0+0 8-bit CMYK 2.965MB 0.000u 0:00.000


TIFF :

identify fontaine_p7p.tif
fontaine_p7p.tif TIFF 782x819 782x819+0+0 8-bit CMYK 1.552MB 0.000u 0:00.000

It seems that imagemagick is not handling transparency is the same way as Photoshop during conversion to Tiff.

Is somebody have proposition to have a better result with such kind of procedure ? I already tried to replace the "-flatten" option by "-layers merge" but in that case the transparency background is completely replace by white or black background.

Thanks in advance

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-15T10:50:39-07:00
by fmw42
.
The first layer of the PSD is the flattened image. Try adding -define tiff:alpha=associated

Code: Select all

convert "fontaine_p7p.psd[0]" -compress LZW -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_1.tif
The above seems to work for me on IM 6.9.2.8 Q16 Mac OSX

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-16T07:59:53-07:00
by aureld
Hi fmw42,

Thank you for your help, the flattened tips on psd[0] is very appreciated.

Anyway, even if it seems to work with your command, their is a visible impact on the tiff generated by ImageMagick which is not present when image are converted thanks to PhotoShop :
Image

The water of the imagemagick tiff is not as dark as from the original PSD. When converting with PhotoShop if there is deferences, they are not visible for my eyes.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-16T10:31:48-07:00
by fmw42
IM conversion of layer 0 with transparency has had trouble and has not always matched PS. But I thought it had been fixed not too long ago. Nevertheless I have had good luck doing the following:

Code: Select all

convert fontaine_p7p.psd \
\( -clone 0 -channel rgba -evaluate set 0 \) \
\( -clone 1--1 \) \
-delete 0 -background none -layers merge +repage \
-compress LZW -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_im.tif
Does that work better? If not, then report it on the Bugs forum and see what they can find out about your image and tell you.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-16T13:51:20-07:00
by fmw42
I just recalled what the issue is. When IM processes the layer 0, the transparency is merged twice. This was fixed in 6.9.2.5 with the addition of a new -define to avoid the double merging. So try the following and see if that works.

Code: Select all

convert -define psd:alpha-unblend=off "fontaine_p7p.psd[0]" \
-compress LZW -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_im.tif
Also see my workaround above if you do not have IM 6.9.2.5.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-17T04:07:55-07:00
by aureld
Hi Fmw42,

Your knowledge is particularly welcomed. Thank you again for your support.
Unfortunately, the visible differences on transparency are still present :
Image

Here is my config:

Code: Select all

convert -version
Version: ImageMagick 6.9.2-7 Q16 i686 2015-12-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib djvu fontconfig freetype gvc jng jpeg lqr openexr pangocairo png tiff wmf x xml zlib
It was compiled from last week source on Linux. I suppose I should have the fix you mentioned.

The PSD : https://drive.google.com/file/d/0ByRmRq ... sp=sharing

Code: Select all

Image: fontaine_p7p.psd
  Base filename: fontaine_p7p.psd
  Format: PSD (Adobe Photoshop bitmap)
  Class: DirectClass
  Geometry: 782x819+0+0
  Resolution: 400x400
  Print size: 1.955x2.0475
  Units: PixelsPerInch
  Type: ColorSeparationAlpha
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 640458
    Cyan:
      min: 0 (0)
      max: 121 (0.47451)
      mean: 30.3622 (0.119067)
      standard deviation: 29.2749 (0.114804)
      kurtosis: -0.72927
      skewness: 0.537348
      entropy: 0.768198
    Magenta:
      min: 0 (0)
      max: 60 (0.235294)
      mean: 7.85979 (0.0308227)
      standard deviation: 11.0783 (0.0434441)
      kurtosis: 2.6659
      skewness: 1.76642
      entropy: 0.691477
    Yellow:
      min: 0 (0)
      max: 219 (0.858824)
      mean: 21.8522 (0.0856948)
      standard deviation: 43.1722 (0.169303)
      kurtosis: 3.65677
      skewness: 2.17511
      entropy: 0.570993
    Black:
      min: 0 (0)
      max: 2 (0.00784314)
      mean: 0.125669 (0.000492821)
      standard deviation: 0.382419 (0.00149968)
      kurtosis: 9.9438
      skewness: 3.17653
      entropy: 0.0811999
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 135.977 (0.533244)
      standard deviation: 106.693 (0.418404)
      kurtosis: -1.66293
      skewness: 0.232002
      entropy: 0.735051
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 35.8445 (0.140567)
      standard deviation: 53.3425 (0.209186)
      kurtosis: 16.9382
      skewness: 4.89605
      entropy: 0.569384
  Total ink density: 127.059%
  Alpha: cmyka(0,0,0,0,0)   #0000000000
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: cmyka(255,255,255,0,1)
  Border color: cmyka(223,223,223,0,1)
  Matte color: cmyka(189,189,189,0,1)
  Transparent color: cmyka(0,0,0,0,0)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 782x819+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: RLE
  Orientation: Undefined
  Properties:
    date:create: 2015-12-07T16:20:21+01:00
    date:modify: 2015-12-07T14:36:26+01:00
    dc:format: application/vnd.adobe.photoshop
    photoshop:ColorMode: 4
    signature: 64874eccc739cd594880eb742e54b82eddaf6365f257d69be3df624dc32cfaea
    tiff:XResolution: 400
    tiff:YResolution: 400
    xmp:CreateDate: 2015-11-18T15:03:34+01:00
    xmp:CreatorTool: Adobe Photoshop CC 2015 (Macintosh)
    xmp:MetadataDate: 2015-12-07T14:36:19+01:00
    xmp:ModifyDate: 2015-12-07T14:36:19+01:00
    xmpMM:DocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    xmpMM:InstanceID: xmp.iid:028011740720681188C6A76B9F39E324
    xmpMM:OriginalDocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
  Profiles:
    Profile-8bim: 25204 bytes
    Profile-exif: 306 bytes
    Profile-iptc: 15 bytes
      City[1,90]: 0x00000000: 254700                                        -%
      unknown[2,0]:
    Profile-xmp: 14936 bytes
  Artifacts:
    filename: fontaine_p7p.psd[0]
    verbose: true
  Tainted: False
  Filesize: 2.965MB
  Number pixels: 640K
  Pixels per second: 160.11GB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.2-7 Q16 i686 2015-12-04 http://www.imagemagick.org
And the result https://drive.google.com/file/d/0ByRmRq ... sp=sharing :

Code: Select all

Image: fontaine_p7p_im.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 782x819+0+0
  Resolution: 400x400
  Print size: 1.955x2.0475
  Units: PixelsPerInch
  Type: ColorSeparationAlpha
  Base type: ColorSeparation
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8/16-bit
  Channel depth:
    cyan: 16-bit
    magenta: 16-bit
    yellow: 16-bit
    black: 16-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 640458
    Cyan:
      min: 0 (0)
      max: 121 (0.475212)
      mean: 30.3257 (0.118924)
      standard deviation: 29.301 (0.114906)
      kurtosis: -0.732841
      skewness: 0.534662
      entropy: 0.608154
    Magenta:
      min: 0 (0)
      max: 60 (0.235294)
      mean: 7.87743 (0.0308919)
      standard deviation: 11.0825 (0.0434607)
      kurtosis: 2.64938
      skewness: 1.75907
      entropy: 0.58517
    Yellow:
      min: 0 (0)
      max: 219 (0.858824)
      mean: 21.8699 (0.0857642)
      standard deviation: 43.1668 (0.169282)
      kurtosis: 3.6565
      skewness: 2.17479
      entropy: 0.585674
    Black:
      min: 0 (0)
      max: 3 (0.0135195)
      mean: 0.125908 (0.000493756)
      standard deviation: 0.383251 (0.00150295)
      kurtosis: 9.97017
      skewness: 3.1793
      entropy: 0.0447768
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 135.977 (0.533244)
      standard deviation: 106.693 (0.418404)
      kurtosis: -1.66293
      skewness: 0.232002
      entropy: 0.395193
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 35.8443 (0.140566)
      standard deviation: 53.3447 (0.209195)
      kurtosis: 16.935
      skewness: 4.89536
      entropy: 0.443794
  Total ink density: 127.059%
  Alpha: cmyka(0,0,0,0,0)   #0000000000
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: cmyka(255,255,255,0,1)
  Border color: cmyka(223,223,223,0,1)
  Matte color: cmyka(189,189,189,0,1)
  Transparent color: cmyka(0,0,0,0,0)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 782x819+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: LZW
  Orientation: TopLeft
  Properties:
    date:create: 2015-12-17T09:31:26+01:00
    date:modify: 2015-12-17T09:31:26+01:00
    dc:format: application/vnd.adobe.photoshop
    photoshop:ColorMode: 4
    signature: 5228beb63483103e9ae85b166f199be452634bf2c083d080c73fe83ad4593e8e
    tiff:alpha: associated
    tiff:endian: msb
    tiff:photometric: separated
    tiff:rows-per-strip: 2
    xmp:CreateDate: 2015-11-18T15:03:34+01:00
    xmp:CreatorTool: Adobe Photoshop CC 2015 (Macintosh)
    xmp:MetadataDate: 2015-12-07T14:36:19+01:00
    xmp:ModifyDate: 2015-12-07T14:36:19+01:00
    xmpMM:DocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    xmpMM:InstanceID: xmp.iid:028011740720681188C6A76B9F39E324
    xmpMM:OriginalDocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
  Profiles:
    Profile-8bim: 25204 bytes
    Profile-exif: 306 bytes
    Profile-iptc: 16 bytes
      City[1,90]: 0x00000000: 254700                                        -%
      unknown[2,0]:
    Profile-xmp: 14936 bytes
  Artifacts:
    filename: fontaine_p7p_im.tif
    verbose: true
  Tainted: False
  Filesize: 1.503MB
  Number pixels: 640K
  Pixels per second: 106.74GB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.2-7 Q16 i686 2015-12-04 http://www.imagemagick.org
If it can help, here is the converted Tif thanks to PS 2015 (MAC) where there is no visible impact :https://drive.google.com/file/d/0ByRmRq ... sp=sharing

Code: Select all

Image: fontaine_p7p_PS.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 782x819+0+0
  Resolution: 400x400
  Print size: 1.955x2.0475
  Units: PixelsPerInch
  Type: ColorSeparationAlpha
  Base type: ColorSeparation
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8/16-bit
  Channel depth:
    cyan: 16-bit
    magenta: 16-bit
    yellow: 16-bit
    black: 16-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 640458
    Cyan:
      min: 0 (0)
      max: 255 (1)
      mean: 40.6916 (0.159575)
      standard deviation: 40.6915 (0.159574)
      kurtosis: 0.0966753
      skewness: 0.838631
      entropy: 0.624419
    Magenta:
      min: 0 (0)
      max: 85 (0.333333)
      mean: 9.38386 (0.0367994)
      standard deviation: 12.2313 (0.0479659)
      kurtosis: 1.55778
      skewness: 1.49636
      entropy: 0.597693
    Yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 22.8797 (0.0897244)
      standard deviation: 43.0275 (0.168735)
      kurtosis: 3.62759
      skewness: 2.15714
      entropy: 0.602633
    Black:
      min: 0 (0)
      max: 3 (0.0135195)
      mean: 0.125908 (0.000493756)
      standard deviation: 0.383251 (0.00150295)
      kurtosis: 9.97017
      skewness: 3.1793
      entropy: 0.0435221
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 135.977 (0.533244)
      standard deviation: 106.693 (0.418404)
      kurtosis: -1.66293
      skewness: 0.232002
      entropy: 0.384119
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 38.4208 (0.15067)
      standard deviation: 54.8458 (0.215081)
      kurtosis: 14.1803
      skewness: 4.38431
      entropy: 0.450477
  Total ink density: 133.333%
  Alpha: cmyka(0,0,0,0,0)   #0000000000
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: cmyka(255,255,255,0,1)
  Border color: cmyka(223,223,223,0,1)
  Matte color: cmyka(189,189,189,0,1)
  Transparent color: cmyka(0,0,0,0,0)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 782x819+0+0
  Dispose: Undefined
  Iterations: 0
  Scene: 0 of 2
  Compression: LZW
  Orientation: TopLeft
  Properties:
    date:create: 2015-12-17T12:00:26+01:00
    date:modify: 2015-12-17T12:00:26+01:00
    dc:format: image/tiff
    exif:PixelXDimension: 782
    exif:PixelYDimension: 819
    photoshop:ColorMode: 4
    signature: 48a45ac3d5492047925cffd59f11f68954ebac1f9dbd9abc8fba6d8c22ca5809
    stRef:documentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    stRef:instanceID: xmp.iid:01801174072068118083DC9AEBA4E2BF
    stRef:originalDocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    tiff:alpha: associated
    tiff:endian: msb
    tiff:photometric: separated
    tiff:rows-per-strip: 67
    tiff:software: Adobe Photoshop CS5 Macintosh
    tiff:timestamp: 2015:12:17 10:30:06
    xmp:CreateDate: 2015-11-18T15:03:34+01:00
    xmp:CreatorTool: Adobe Photoshop CS5.1 Macintosh
    xmp:MetadataDate: 2015-12-17T10:30:06+01:00
    xmp:ModifyDate: 2015-12-17T10:30:06+01:00
    xmpMM:DocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    xmpMM:InstanceID: xmp.iid:02801174072068118083DC9AEBA4E2BF
    xmpMM:OriginalDocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
  Profiles:
    Profile-8bim: 8278 bytes
    Profile-tiff:37724: 1245032 bytes
    Profile-xmp: 16712 bytes
  Artifacts:
    filename: fontaine_p7p_PS.tif
    tiff:has-layers: true
    verbose: true
  Tainted: False
  Filesize: 2.217MB
  Number pixels: 640K
  Pixels per second: 80.057GB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.2-7 Q16 i686 2015-12-04 http://www.imagemagick.org
Image: fontaine_p7p_PS.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 782x819+0+0
  Resolution: 400x400
  Print size: 1.955x2.0475
  Units: PixelsPerInch
  Type: ColorSeparationAlpha
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 640458
    Cyan:
      min: 0 (0)
      max: 165 (0.647059)
      mean: 41.5746 (0.163038)
      standard deviation: 40.4712 (0.15871)
      kurtosis: 0.0572636
      skewness: 0.830324
      entropy: 0.767413
    Magenta:
      min: 0 (0)
      max: 60 (0.235294)
      mean: 9.55659 (0.0374768)
      standard deviation: 12.1165 (0.0475157)
      kurtosis: 1.51951
      skewness: 1.49305
      entropy: 0.752104
    Yellow:
      min: 0 (0)
      max: 219 (0.858824)
      mean: 23.0194 (0.090272)
      standard deviation: 42.9508 (0.168434)
      kurtosis: 3.64183
      skewness: 2.16108
      entropy: 0.628676
    Black:
      min: 0 (0)
      max: 2 (0.00784314)
      mean: 0.125985 (0.000494058)
      standard deviation: 0.382976 (0.00150187)
      kurtosis: 9.91621
      skewness: 3.17287
      entropy: 0.0768033
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 135.977 (0.533244)
      standard deviation: 106.693 (0.418404)
      kurtosis: -1.66293
      skewness: 0.232002
      entropy: 0.69408
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 38.6599 (0.151607)
      standard deviation: 54.796 (0.214886)
      kurtosis: 14.1632
      skewness: 4.38017
      entropy: 0.583815
  Total ink density: 127.059%
  Alpha: cmyka(0,0,0,0,0)   #0000000000
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: cmyka(255,255,255,0,1)
  Border color: cmyka(223,223,223,0,1)
  Matte color: cmyka(189,189,189,0,1)
  Transparent color: cmyka(0,0,0,0,0)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 782x819+0+0
  Dispose: Undefined
  Iterations: 0
  Scene: 1 of 2
  Compression: RLE
  Orientation: TopLeft
  Properties:
    date:create: 2015-12-17T12:00:37+01:00
    date:modify: 2015-12-17T12:00:37+01:00
    dc:format: image/tiff
    exif:PixelXDimension: 782
    exif:PixelYDimension: 819
    label: fontaine
    photoshop:ColorMode: 4
    signature: 7509f93c417271833d4fe6c348e8a6afffb16f6b283e98b6a4da32713b880d78
    stRef:documentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    stRef:instanceID: xmp.iid:01801174072068118083DC9AEBA4E2BF
    stRef:originalDocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    tiff:alpha: associated
    tiff:endian: msb
    tiff:photometric: separated
    tiff:rows-per-strip: 67
    tiff:software: Adobe Photoshop CS5 Macintosh
    tiff:timestamp: 2015:12:17 10:30:06
    xmp:CreateDate: 2015-11-18T15:03:34+01:00
    xmp:CreatorTool: Adobe Photoshop CS5.1 Macintosh
    xmp:MetadataDate: 2015-12-17T10:30:06+01:00
    xmp:ModifyDate: 2015-12-17T10:30:06+01:00
    xmpMM:DocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
    xmpMM:InstanceID: xmp.iid:02801174072068118083DC9AEBA4E2BF
    xmpMM:OriginalDocumentID: xmp.did:28e91d18-a1e7-4805-a4ef-1fb4499132d5
  Profiles:
    Profile-8bim: 8278 bytes
    Profile-xmp: 16712 bytes
  Artifacts:
    filename: fontaine_p7p_PS.tif
    psd:layer.opacity: 0
    psd:layer.x: 0
    psd:layer.y: 0
    tiff:has-layers: true
    verbose: true
  Tainted: False
  Filesize: 0B
  Number pixels: 640K
  Pixels per second: 32.023GB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.2-7 Q16 i686 2015-12-04 http://www.imagemagick.org
identify: fontaine_p7p_PS.tif: wrong data type 7 for "RichTIFFIPTC"; tag ignored. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/887.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-17T10:39:32-07:00
by fmw42
.
I did my own tests on IM 6.9.2.8 Q16 Mac OSX and PS (CS) and do indeed still find differences in both LZW and NONE compression. I will link this to a bug report.

Code: Select all

convert -define psd:alpha-unblend=off "fontaine_p7p.psd[0]" \
-compress LZW -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_im_0lzw.tif

convert -define psd:alpha-unblend=off "fontaine_p7p.psd[0]" \
-compress none -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_im_0none.tif

convert fontaine_p7p.psd \
\( -clone 0 -channel rgba -evaluate set 0 \) \
\( -clone 1--1 \) \
-delete 0 -background none -layers merge +repage \
-compress LZW -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_im_1lzw.tif

convert fontaine_p7p.psd \
\( -clone 0 -channel rgba -evaluate set 0 \) \
\( -clone 1--1 \) \
-delete 0 -background none -layers merge +repage \
-compress none -define tiff:alpha=associated -define tiff:endian=msb fontaine_p7p_im_1none.tif

Code: Select all

compare -metric rmse fontaine_p7p_psnone.tif fontaine_p7p_im_0none.tif null:
1210.5 (0.0184711)

compare -metric rmse fontaine_p7p_psnone.tif fontaine_p7p_im_1none.tif null:
3707.37 (0.0565708)

compare -metric rmse fontaine_p7p_pslzw.tif fontaine_p7p_im_0lzw.tif null:
1210.5 (0.0184711)

compare -metric rmse fontaine_p7p_pslzw.tif fontaine_p7p_im_1lzw.tif null:
3707.37 (0.0565708)

http://www.fmwconcepts.com/misc_tests/p ... psnone.tif
http://www.fmwconcepts.com/misc_tests/p ... _pslzw.tif
http://www.fmwconcepts.com/misc_tests/p ... _1none.tif
http://www.fmwconcepts.com/misc_tests/p ... m_0lzw.tif
http://www.fmwconcepts.com/misc_tests/p ... m_1lzw.tif

PS screen snaps:
http://www.fmwconcepts.com/misc_tests/p ... layers.png
http://www.fmwconcepts.com/misc_tests/p ... annels.png

Code: Select all

convert -version
Version: ImageMagick 6.9.2-8 Q16 x86_64 2015-12-07 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules 
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib

P.S. I unlocked the partially locked layers and tried again, but with the same results as above.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-18T02:35:02-07:00
by aureld
Hi fmw42,

If an expert like you cannot have better result, a beginner like me will have to give up and wait for the bug fix.
When it will be opened, can you please give me the link to the bug report or post a message here to let me know in which version the problem will be fixed?

Thanks in advance and one more time, thank you for your availability,

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2015-12-18T03:15:38-07:00
by dlemstra
This is the bug report: viewtopic.php?f=3&t=28850

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2016-01-12T07:11:37-07:00
by magick
Its likely the pixel results are slightly altered when exported to TIFF by Photoshop. ImageMagick just reads the raw pixels and outputs the raw pixels unless acted upon by an option such as -profile or -gamma. Unless we know what sort of pixel transform Photoshop applies, there is little hope of exactly matching the results.

We did check ImageMagick PSD and TIFF readers and we did not find any evidence of a bug. Add -debug coder to your convert command line. You'll see we read the composite layer that Photoshop provides, a 5 channel CMYKA pixel image @ 8-bits. We in turn push those same pixel bytes to TIFF. The PDF resource block contains a simple XMP profile and it does not appear to have any special instructions for a pixel transform. If you can provide evidence of a bug, we will investigate further.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2016-01-12T08:38:04-07:00
by aureld
I am not a picture format professional so I am not sure to catch everything you said. I am just a developer who tries to create a conversion workflow.
What I can tell you is when my colleagues convert PSD to TIFF thanks to Photoshop, there is no visible differences when you display the two pictures side by side.
When fmw42 and I tried to convert the same PSD to TIFF using ImageMagick 6.9.2-7, the differences are clearly discernible to the naked eye. This is the only evidence of a bug I can provide you.
May be fmw42 will have more "expert" information if he always follow this thread.

Anyway, thank you for the attention you payed on my issue. I will try to provide you the "convert -debug" you asked soon.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2016-01-12T10:09:57-07:00
by fmw42
The only issue that I see is that your PSD file has a group layer. Imagemagick does not know how to handle that fully. I suspect that is the issue. Try removing the group layer and make the equivalent file from all your layers. Then try my commands above.

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2016-01-12T10:18:38-07:00
by aureld
The idea of my development is to automate the conversion of PSD into TIFF without humane action.
So if it can help to resolve the issue, yes I can try this as one-shoot, but otherwise I will have to search on other solution for my automation.
It is possible to detect PSD file containing "group layper" thanks to "identify" command? If yes, I can at least automatically reject those files from automated workflow/

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2016-01-12T10:30:49-07:00
by magick
This works for us:
  • -> convert -define psd:alpha-unblend=off "fontaine_p7p.psd[0]" -compress none -define tiff:alpha=unassociated -define tiff:endian=msb fontaine_p7p.tif
    -> compare -metric rmse fontaine_p7p.tif "fontaine_p7p.psd[0]" null:
    0 (0)
Does that work as a baseline?

Re: Convert a multi layers psd into a merged layer tiff without visible modification

Posted: 2016-01-13T02:40:22-07:00
by aureld
Hi magick,

Yes, I obtain the same command line returns even with compare -metric.
Unfortunately the visible differences are still there ...

Image

Where should I include the "-debug" parameter?