Size difference between image magick and Photoshop conversio

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
fdgdfgsd
Posts: 6
Joined: 2013-04-30T01:25:14-07:00
Authentication code: 6789

Size difference between image magick and Photoshop conversio

Post by fdgdfgsd »

Hi all,

I'm having a trouble with image conversion from pdf to tiff.

I use this command:

Code: Select all

convert.exe -density 300 -depth 8 -compress lzw -colorspace CMYK fileIN fileOUT.tiff
Then i get an image which its size it's aprox 3.34MB, BUT when i convert the same pdf to tiff with photoshop I get an image which its size it's ~1.5Mb (deleting layers, ICC profile, 8bits, 300dpi, compress lzw, colorspace cmyk).

In the begining i thought that it had something to do with ICC profile and used -strip parameter, but i got the same file size:

Code: Select all

convert.exe -strip -density 300 -depth 8 -compress lzw -colorspace CMYK fileIN fileOUT.tiff
Then i decided to compare both file image propierties, so this is what i got:

photoshop
Image: C:\tst_IM\PS.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2480x3508+0+0
Resolution: 300x300
Print size: 8.26667x11.6933
Units: PixelsPerInch
Type: ColorSeparation
Base type: ColorSeparation
Endianess: MSB
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 8-bit
magenta: 8-bit
yellow: 8-bit
black: 8-bit
Channel statistics:
Cyan:
min: 0 (0)
max: 255 (1)
mean: 10.7843 (0.0422913)
standard deviation: 45.0813 (0.176789)
kurtosis: 20.2304
skewness: 4.58556
Magenta:
min: 0 (0)
max: 255 (1)
mean: 21.3051 (0.0835495)
standard deviation: 59.8728 (0.234795)
kurtosis: 6.55058
skewness: 2.83086
Yellow:
min: 0 (0)
max: 255 (1)
mean: 21.7532 (0.0853067)
standard deviation: 68.4563 (0.268456)
kurtosis: 7.2909
skewness: 3.01633
Black:
min: 0 (0)
max: 255 (1)
mean: 4.5587 (0.0178772)
standard deviation: 22.6715 (0.088908)
kurtosis: 36.0109
skewness: 5.70393
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 14.6003 (0.0572562)
standard deviation: 52.0032 (0.203934)
kurtosis: 13.8454
skewness: 3.90259
Total ink density: 298%
Rendering intent: Undefined
Gamma: 1
Interlace: None
Background color: cmyk(255,255,255,0)
Border color: cmyk(223,223,223,0)
Matte color: cmyk(189,189,189,0)
Transparent color: cmyk(0,0,0,0)
Compose: Over
Page geometry: 2480x3508+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
date:create: 2013-04-30T10:00:58+02:00
date:modify: 2013-04-30T10:01:07+02:00
dc:format: image/tiff
exif:ColorSpace: -1
exif:NativeDigest: 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;4C71CAEBC1628FBC54BAFD3DC17F1A1D
exif:PixelXDimension: 2480
exif:PixelYDimension: 3508
photoshop:ColorMode: 4
photoshop:History:
photoshop:ICCProfile: U.S. Web Coated (SWOP) v2
signature: 6bbcf8f82807467987cabf0baf493bb915864954720c35091b4aaa959228da4b
stRef:documentID: uuid:7371430B6CB1E21187F2E842741DEB6D
stRef:instanceID: uuid:7371430B6CB1E21187F2E842741DEB6D
tiff:endian: lsb
tiff:NativeDigest: 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;DB0F3CF97C5B0C90B2860025A05C73A8
tiff:photometric: separated
tiff:rows-per-strip: 26
tiff:software: Adobe Photoshop CS2 Windows
tiff:timestamp: 2013:04:30 10:00:58
tiff:XResolution: 3000000/10000
tiff:YResolution: 3000000/10000
xap:CreateDate: 2013-04-30T10:00:58+02:00
xap:CreatorTool: Adobe Photoshop CS2 Windows
xap:MetadataDate: 2013-04-30T10:00:58+02:00
xap:ModifyDate: 2013-04-30T10:00:58+02:00
xapMM:DocumentID: uuid:7471430B6CB1E21187F2E842741DEB6D
xapMM:InstanceID: uuid:7571430B6CB1E21187F2E842741DEB6D
Profiles:
Profile-8bim: 6436 bytes
Profile-xmp: 15007 bytes
Artifacts:
filename: C:\tst_IM\PS.tif
verbose: true
Tainted: False
Filesize: 1.546MB
Number pixels: 8.7M
Pixels per second: 54.37MB
User time: 0.172u
Elapsed time: 0:01.159
Version: ImageMagick 6.8.0-1 2012-10-15 Q16 http://www.imagemagick.org
IM strip:
Image: C:\Users\npana\Desktop\tst_IM\IM.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2480x3508+0+0
Resolution: 300x300
Print size: 8.26667x11.6933
Units: Undefined
Type: ColorSeparation
Base type: ColorSeparation
Endianess: MSB
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 8-bit
magenta: 8-bit
yellow: 8-bit
black: 8-bit
Channel statistics:
Cyan:
min: 0 (0)
max: 255 (1)
mean: 11.0218 (0.0432229)
standard deviation: 45.1524 (0.177068)
kurtosis: 19.2615
skewness: 4.47653
Magenta:
min: 0 (0)
max: 255 (1)
mean: 24.2886 (0.0952495)
standard deviation: 63.2928 (0.248207)
kurtosis: 4.64188
skewness: 2.48963
Yellow:
min: 0 (0)
max: 255 (1)
mean: 24.6865 (0.09681)
standard deviation: 69.0725 (0.270872)
kurtosis: 6.33012
skewness: 2.811
Black:
min: 0 (0)
max: 225 (0.882353)
mean: 2.43497 (0.00954889)
standard deviation: 14.3269 (0.0561838)
kurtosis: 103.506
skewness: 8.91966
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 15.608 (0.0612078)
standard deviation: 52.4904 (0.205845)
kurtosis: 12.9171
skewness: 3.79092
Total ink density: 296%
Rendering intent: Undefined
Gamma: 1
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)
Interlace: None
Background color: cmyk(255,255,255,0)
Border color: cmyk(223,223,223,0)
Matte color: cmyk(189,189,189,0)
Transparent color: cmyk(0,0,0,0)
Compose: Over
Page geometry: 2480x3508+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
date:create: 2013-04-30T10:07:02+02:00
date:modify: 2013-04-30T10:07:03+02:00
signature: e72ae26947d2501692a07256a82e76857ae643a4c5cc0e24e91f4587a4804cd7
tiff:document: C:\Users\npana\Desktop\tst_IM\IM.pdf.tiff
tiff:endian: lsb
tiff:photometric: separated
tiff:rows-per-strip: 1
Artifacts:
filename: C:\Users\npana\Desktop\tst_IM\IM.tiff
verbose: true
Tainted: False
Filesize: 3.419MB
Number pixels: 8.7M
Pixels per second: 36.55MB
User time: 0.234u
Elapsed time: 0:01.237
Version: ImageMagick 6.8.0-1 2012-10-15 Q16 http://www.imagemagick.org
IM_NOstrip.tiff.nfo
Image: C:\Users\npana\Desktop\tst_IM\IM_NOstrip.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2480x3508+0+0
Resolution: 300x300
Print size: 8.26667x11.6933
Units: Undefined
Type: ColorSeparation
Base type: ColorSeparation
Endianess: MSB
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 8-bit
magenta: 8-bit
yellow: 8-bit
black: 8-bit
Channel statistics:
Cyan:
min: 0 (0)
max: 255 (1)
mean: 11.0218 (0.0432229)
standard deviation: 45.1524 (0.177068)
kurtosis: 19.2615
skewness: 4.47653
Magenta:
min: 0 (0)
max: 255 (1)
mean: 24.2886 (0.0952495)
standard deviation: 63.2928 (0.248207)
kurtosis: 4.64188
skewness: 2.48963
Yellow:
min: 0 (0)
max: 255 (1)
mean: 24.6865 (0.09681)
standard deviation: 69.0725 (0.270872)
kurtosis: 6.33012
skewness: 2.811
Black:
min: 0 (0)
max: 225 (0.882353)
mean: 2.43497 (0.00954889)
standard deviation: 14.3269 (0.0561838)
kurtosis: 103.506
skewness: 8.91966
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 15.608 (0.0612078)
standard deviation: 52.4904 (0.205845)
kurtosis: 12.9171
skewness: 3.79092
Total ink density: 296%
Rendering intent: Undefined
Gamma: 1
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)
Interlace: None
Background color: cmyk(255,255,255,0)
Border color: cmyk(223,223,223,0)
Matte color: cmyk(189,189,189,0)
Transparent color: cmyk(0,0,0,0)
Compose: Over
Page geometry: 2480x3508+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
date:create: 2013-04-30T10:09:35+02:00
date:modify: 2013-04-30T10:09:36+02:00
signature: e72ae26947d2501692a07256a82e76857ae643a4c5cc0e24e91f4587a4804cd7
tiff:document: C:\Users\npana\Desktop\tst_IM\IM.pdf.tiff
tiff:endian: lsb
tiff:photometric: separated
tiff:rows-per-strip: 1
Artifacts:
filename: C:\Users\npana\Desktop\tst_IM\IM_NOstrip.tiff
verbose: true
Tainted: False
Filesize: 3.419MB
Number pixels: 8.7M
Pixels per second: 33.98MB
User time: 0.265u
Elapsed time: 0:01.256
Version: ImageMagick 6.8.0-1 2012-10-15 Q16 http://www.imagemagick.org
So basically no differences between NOstrip and strip files, but some changes that i'm not able to understand in photoshop's file info. Do you know how to solve this in ?

filecompare:

Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Size difference between image magick and Photoshop conve

Post by snibgo »

Both programs are rastersing vector data; some of that may be text. If you examine the two resulting images, magnified, you'll probably see they are different. Two images that are different will compress by different amounts.

If you want a greater compression, you might try the other compression algorithms, eg jpeg.
snibgo's IM pages: im.snibgo.com
fdgdfgsd
Posts: 6
Joined: 2013-04-30T01:25:14-07:00
Authentication code: 6789

Re: Size difference between image magick and Photoshop conve

Post by fdgdfgsd »

Hi!

Differences are almost inapreciable zooming the image (left PS, right IM):

Image

Main difference is antialias applied by photoshop, which I don't care if IM can't do it. Now that i think in AA, may this effect cause this big filesize difference?

In what is regarded to image compression, I can't use other than LZW. It has to be LZW cause i need to postprocess the image and this is a requirement.

Any other idea? Thanks in advance
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Size difference between image magick and Photoshop conve

Post by glennrp »

Maybe the difference in "rows per strip" is causing the filesize difference.
Try

Code: Select all

 -define tiff:rows-per-strip=26
fdgdfgsd
Posts: 6
Joined: 2013-04-30T01:25:14-07:00
Authentication code: 6789

Re: Size difference between image magick and Photoshop conve

Post by fdgdfgsd »

Good point. With this param image has decreased its size. Now it's ~2.6Mb, but stills being bigger than photoshop one.

Here comes the new image info:
Image: C:\tst_IM\IM_TIFF_STRIP.pdf.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2480x3508+0+0
Resolution: 300x300
Print size: 8.26667x11.6933
Units: Undefined
Type: ColorSeparation
Base type: ColorSeparation
Endianess: MSB
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 8-bit
magenta: 8-bit
yellow: 8-bit
black: 8-bit
Channel statistics:
Cyan:
min: 0 (0)
max: 255 (1)
mean: 11.0218 (0.0432229)
standard deviation: 45.1524 (0.177068)
kurtosis: 19.2615
skewness: 4.47653
Magenta:
min: 0 (0)
max: 255 (1)
mean: 24.2886 (0.0952495)
standard deviation: 63.2928 (0.248207)
kurtosis: 4.64188
skewness: 2.48963
Yellow:
min: 0 (0)
max: 255 (1)
mean: 24.6865 (0.09681)
standard deviation: 69.0725 (0.270872)
kurtosis: 6.33012
skewness: 2.811
Black:
min: 0 (0)
max: 225 (0.882353)
mean: 2.43497 (0.00954889)
standard deviation: 14.3269 (0.0561838)
kurtosis: 103.506
skewness: 8.91966
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 15.608 (0.0612078)
standard deviation: 52.4904 (0.205845)
kurtosis: 12.9171
skewness: 3.79092
Total ink density: 296%
Rendering intent: Undefined
Gamma: 1
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)
Interlace: None
Background color: cmyk(255,255,255,0)
Border color: cmyk(223,223,223,0)
Matte color: cmyk(189,189,189,0)
Transparent color: cmyk(0,0,0,0)
Compose: Over
Page geometry: 2480x3508+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
date:create: 2013-05-02T16:30:52+02:00
date:modify: 2013-05-02T16:30:53+02:00
signature: e72ae26947d2501692a07256a82e76857ae643a4c5cc0e24e91f4587a4804cd7
tiff:document: C:\tst_IM\IM_TIFF_STRIP.pdf.tiff
tiff:endian: lsb
tiff:photometric: separated
Artifacts:
filename: C:\tst_IM\IM_TIFF_STRIP.pdf.tiff
verbose: true
Tainted: False
Filesize: 2.703MB
Number pixels: 8.7M
Pixels per second: 51.78MB
User time: 0.156u
Elapsed time: 0:01.167
Version: ImageMagick 6.8.0-1 2012-10-15 Q16 http://www.imagemagick.org
I been playing around with antialias property, but seems that this won't be the key to solve the problem.
Britfox
Posts: 1
Joined: 2013-05-05T08:32:09-07:00
Authentication code: 6789

Re: Size difference between image magick and Photoshop conve

Post by Britfox »

It's the rows-per-strip parameter like previously said by glennrp.

But look in your last post... The rows-per-strip isn't defined. He just disappeared ! So it's still not like the photoshop result.

I have the same problem than you and i'm still unable to define it with the windows version of imagemagick.

I'm still wondering if it's an imagemagick bug or if my command line is incorrect...
fdgdfgsd
Posts: 6
Joined: 2013-04-30T01:25:14-07:00
Authentication code: 6789

Re: Size difference between image magick and Photoshop conve

Post by fdgdfgsd »

Yes, you're right, seems that "-define tiff:rows-per-strip=26" isn't working properly. I been trying it out and I'm always getting the same result. No matter what value I use, image has the same filesize and looses the property in the fileinfo (¿?)

I'm also working with windows version.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Size difference between image magick and Photoshop conve

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-5 Beta available by sometime tomorrow. Thanks.
fdgdfgsd
Posts: 6
Joined: 2013-04-30T01:25:14-07:00
Authentication code: 6789

Re: Size difference between image magick and Photoshop conve

Post by fdgdfgsd »

That would be perfect. Thanks in advance!
fdgdfgsd
Posts: 6
Joined: 2013-04-30T01:25:14-07:00
Authentication code: 6789

Re: Size difference between image magick and Photoshop conve

Post by fdgdfgsd »

Hello again,

Now im using ImageMagick-6.8.5-Q16 which seems to work fine in what is regarded to "rows-per-strip" property, BUT now I have an image which its filesize is ~2.7MB so no way to reduce ir :S

new fileinfo:
convert.exe -define tiff:rows-per-strip=26 -density 300 -depth 8 -compress lzw -colorspace CMYK in.pdf out.tiff

Code: Select all

Image: C:\tst_IM\IM.pdf.tiff
  Format: TIFF (Tagged Image File Format)
  Class: DirectClass
  Geometry: 2480x3508+0+0
  Resolution: 300x300
  Print size: 8.26667x11.6933
  Units: Undefined
  Type: ColorSeparation
  Base type: ColorSeparation
  Endianess: MSB
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    Cyan:
      min: 0 (0)
      max: 255 (1)
      mean: 11.0218 (0.0432229)
      standard deviation: 45.1524 (0.177068)
      kurtosis: 19.2615
      skewness: 4.47653
    Magenta:
      min: 0 (0)
      max: 255 (1)
      mean: 24.2886 (0.0952495)
      standard deviation: 63.2928 (0.248207)
      kurtosis: 4.64188
      skewness: 2.48963
    Yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 24.6865 (0.09681)
      standard deviation: 69.0725 (0.270872)
      kurtosis: 6.33012
      skewness: 2.811
    Black:
      min: 0 (0)
      max: 225 (0.882353)
      mean: 2.43497 (0.00954889)
      standard deviation: 14.3269 (0.0561838)
      kurtosis: 103.506
      skewness: 8.91966
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 15.608 (0.0612078)
      standard deviation: 52.4904 (0.205845)
      kurtosis: 12.9171
      skewness: 3.79092
  Total ink density: 296%
  Rendering intent: Undefined
  Gamma: 1
  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)
  Interlace: None
  Background color: cmyk(255,255,255,0)
  Border color: cmyk(223,223,223,0)
  Matte color: cmyk(189,189,189,0)
  Transparent color: cmyk(0,0,0,0)
  Compose: Over
  Page geometry: 2480x3508+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: LZW
  Orientation: TopLeft
  Properties:
    date:create: 2013-05-08T08:50:10+02:00
    date:modify: 2013-05-08T08:50:10+02:00
    signature: e72ae26947d2501692a07256a82e76857ae643a4c5cc0e24e91f4587a4804cd7
    tiff:document: C:\tst_IM\IM.pdf.tiff
    tiff:endian: lsb
    tiff:photometric: separated
    tiff:rows-per-strip: 26
  Artifacts:
    filename: C:\tst_IM\IM.pdf.tiff
    verbose: true
  Tainted: False
  Filesize: 2.777MB
  Number pixels: 8.7M
  Pixels per second: 50MB
  User time: 0.172u
  Elapsed time: 0:01.174
  Version: ImageMagick 6.8.0-1 2012-10-15 Q16 http://www.imagemagick.org
Post Reply