Output of Convert is larger than expected
Output of Convert is larger than expected
I have a a hi-res image that when I run the following gives me unexpected results.
convert old.tif new.tif
old.tif 864k
new.tif 1.18k
Why is the new tif file so much larger? I ran identify -verbose on both images and
the only difference I see is
tiff:rows-per-strip is 36 in the original image and is only 1 in the new image. Would
this cause the difference in files size? BTW, both images are shown to be LZW compressed.
Could it be that the original image was compressed with a "better" LZW?
I also see this difference:
Profile-iptc: 8 bytes in original, 12 bytes in new image
Any ideas?
Thanks,
John
convert old.tif new.tif
old.tif 864k
new.tif 1.18k
Why is the new tif file so much larger? I ran identify -verbose on both images and
the only difference I see is
tiff:rows-per-strip is 36 in the original image and is only 1 in the new image. Would
this cause the difference in files size? BTW, both images are shown to be LZW compressed.
Could it be that the original image was compressed with a "better" LZW?
I also see this difference:
Profile-iptc: 8 bytes in original, 12 bytes in new image
Any ideas?
Thanks,
John
Re: Output of Convert is larger than expected
Ok, I tried an experiment with the image created by convert. I read it into PhotoShop (CS2) and wrote it back to disk.
It is basically back to the original size now. So, does this mean that the LZW compression in convert is suboptimal or
did I miss a parameter somewhere to crank up the compression rate?
Thanks,
John
It is basically back to the original size now. So, does this mean that the LZW compression in convert is suboptimal or
did I miss a parameter somewhere to crank up the compression rate?
Thanks,
John
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Output of Convert is larger than expected
I am not sure what you did in the first and second case in terms of IM commands but I suspect the issue is with the 8 to 12 bit conversion
8 bytes in original, 12 bytes in new image
What version of IM are you using and did you use before. What version of libtif? Are you specifying anthing special to make it go from 8 bytes per pixel to 12? What is the original image like 8 or 12 bytes per pixel?
8 bytes in original, 12 bytes in new image
What version of IM are you using and did you use before. What version of libtif? Are you specifying anthing special to make it go from 8 bytes per pixel to 12? What is the original image like 8 or 12 bytes per pixel?
Re: Output of Convert is larger than expected
Here is what convert -version says:
C:\im_play_files\cropped_files>convert -version
Version: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
I *think* we are using v3.5.7 of libTIFF.
In the 2 cases I mentioned before, I ran the command line:
convert old.tiff new.tiff
The new.tiff file is much larger in size which concerned me. However when I load it into
Photoshop it "looks" ok and if I save it from there to new_ps.tiff the file size is about the
same as the original which leads me to think that it is something to do with the LZW
compression? As you can see from my command line above, I did not use any command line
options, nor did I set any env. variables to control what convert produced. I was expecting
to get a file that was nearly identical to the input file.
Thanks,
John
C:\im_play_files\cropped_files>convert -version
Version: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
I *think* we are using v3.5.7 of libTIFF.
In the 2 cases I mentioned before, I ran the command line:
convert old.tiff new.tiff
The new.tiff file is much larger in size which concerned me. However when I load it into
Photoshop it "looks" ok and if I save it from there to new_ps.tiff the file size is about the
same as the original which leads me to think that it is something to do with the LZW
compression? As you can see from my command line above, I did not use any command line
options, nor did I set any env. variables to control what convert produced. I was expecting
to get a file that was nearly identical to the input file.
Thanks,
John
Re: Output of Convert is larger than expected
Maybe I should mention that these files are 6400 dpi and I also have some that are 8k dpi
that I will be trying to manipulate with the convert utility.
Thanks,
John
that I will be trying to manipulate with the convert utility.
Thanks,
John
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Output of Convert is larger than expected
dpi will not affect the image size unless you use -resample rather than -resize or -density to change it.
Do you know what IM version you used to use. I suspect that either there was a change in handling of Tif or you had a different libtif and they did not use LZW the same or more likely created different bit depths.
Are you sure you are converting the very same image both times?
Tiff has a lot of possible arguments that could be used or may have been used by default in the past. See http://www.imagemagick.org/Usage/formats/#tiff
you could try a different compression.
Did you say that both files had LZW or not?
Note
" IM also understand writing 12 bit TIFF files...
To convert 16-bit TIFF images to 12-bit:
convert image.tif -depth 12 image-12.tif
"
Perhaps you got that behavior by mistake at some point or your original is 12-bit. What does
identify -verbose originalimage
tell you?
But it is hard to believe that you can get a 12-bit result on a 8-bit IM (Q8)!
Do you know what IM version you used to use. I suspect that either there was a change in handling of Tif or you had a different libtif and they did not use LZW the same or more likely created different bit depths.
Are you sure you are converting the very same image both times?
Tiff has a lot of possible arguments that could be used or may have been used by default in the past. See http://www.imagemagick.org/Usage/formats/#tiff
you could try a different compression.
Did you say that both files had LZW or not?
Note
" IM also understand writing 12 bit TIFF files...
To convert 16-bit TIFF images to 12-bit:
convert image.tif -depth 12 image-12.tif
"
Perhaps you got that behavior by mistake at some point or your original is 12-bit. What does
identify -verbose originalimage
tell you?
But it is hard to believe that you can get a 12-bit result on a 8-bit IM (Q8)!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Output of Convert is larger than expected
Is it possible that you have two versions of IM installed and are using a 16-bit version rather than the 8bit version?
Re: Output of Convert is larger than expected
As far as I can tell, I only have one version of IM installed. Maybe I should give a little background here. The original image was created in PhotoShop and now I am trying to manipulate it with convert, but right away I noticed the increased file size. So I trimmed the command line down to just "convert old.tiff new.tiff" and expected new.tiff to be pretty close to the same file size as old.tiff. However, that is not the case. It almost looks like the file is not compressed, but when running identify -verbose on new.tiff it does show that it is compressed. If I load new.tiff into PhotoShope and jsut do a File, Save As, I get a file that is pretty closed to the file size of old.tiff.
Here is the output (verbose) of identify for old.tiff
Image: old.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 42835x23622+0+0
Resolution: 8000x8000
Print size: 5.35438x2.95275
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: MSB
Colorspace: RGB
Depth: 1-bit
Channel depth:
gray: 1-bit
Channel statistics:
gray:
min: 0 (0)
max: 1 (1)
mean: 0.942929 (0.942929)
standard deviation: 0.231979 (0.231979)
kurtosis: 12.5824
skewness: -3.81869
Histogram:
954100784: (255,255,255) #FFFFFF white
57747586: ( 0, 0, 0) #000000 black
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: black
Page geometry: 42835x23622+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
create-date: 2009-08-11T15:38:53-07: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;2CD38CC7E1796CA1945ED3FC66338B1B
exif:PixelXDimension: 42835
exif:PixelYDimension: 23622
modify-date: 2009-08-05T09:01:33-07:00
photoshop:ColorMode: 0
photoshop:History: 2008-08-15T09:06:57-07:00 File A1_orig_M.tif opened
2008-08-15T09:07:12-07:00 File A1_orig_M.tif saved
2008-08-15T09:24:13-07:00 File A1_orig_M.tif saved
signature: c8b33593b603647403be4d6fe3a8bf6d770d8d4c8f1b4a94f796871b5788b312
tiff:Compression: 5
tiff:ImageLength: 23622
tiff:ImageWidth: 42835
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;8D789BB452CE27B56CEE2C2B2617180D
tiff:Orientation: 1
tiff:PhotometricInterpretation: 0
tiff:rows-per-strip: 48
tiff:SamplesPerPixel: 1
tiff:software: Adobe Photoshop CS3 Windows
tiff:timestamp: 2009:08:05 09:00:11
xap:CreateDate: 2008-08-07T16:49:26-07:00
xap:CreatorTool: Adobe Photoshop CS3 Windows
xap:MetadataDate: 2009-08-05T09:00:11-07:00
xap:ModifyDate: 2009-08-05T09:00:11-07:00
xapMM:InstanceID: uuid:47438E07D981DE1182B4F95825D23362
Profiles:
Profile-8bim: 8110 bytes
Profile-iptc: 8 bytes
unknown[2,0]:
Profile-xmp: 15193 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 2.133mb
Number pixels: 965mb
Pixels per second: 2.218mb
User time: 7.800u
Elapsed time: 7:16
Version: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
Thanks,
John
Here is the output (verbose) of identify for old.tiff
Image: old.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 42835x23622+0+0
Resolution: 8000x8000
Print size: 5.35438x2.95275
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: MSB
Colorspace: RGB
Depth: 1-bit
Channel depth:
gray: 1-bit
Channel statistics:
gray:
min: 0 (0)
max: 1 (1)
mean: 0.942929 (0.942929)
standard deviation: 0.231979 (0.231979)
kurtosis: 12.5824
skewness: -3.81869
Histogram:
954100784: (255,255,255) #FFFFFF white
57747586: ( 0, 0, 0) #000000 black
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: black
Page geometry: 42835x23622+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
create-date: 2009-08-11T15:38:53-07: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;2CD38CC7E1796CA1945ED3FC66338B1B
exif:PixelXDimension: 42835
exif:PixelYDimension: 23622
modify-date: 2009-08-05T09:01:33-07:00
photoshop:ColorMode: 0
photoshop:History: 2008-08-15T09:06:57-07:00 File A1_orig_M.tif opened
2008-08-15T09:07:12-07:00 File A1_orig_M.tif saved
2008-08-15T09:24:13-07:00 File A1_orig_M.tif saved
signature: c8b33593b603647403be4d6fe3a8bf6d770d8d4c8f1b4a94f796871b5788b312
tiff:Compression: 5
tiff:ImageLength: 23622
tiff:ImageWidth: 42835
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;8D789BB452CE27B56CEE2C2B2617180D
tiff:Orientation: 1
tiff:PhotometricInterpretation: 0
tiff:rows-per-strip: 48
tiff:SamplesPerPixel: 1
tiff:software: Adobe Photoshop CS3 Windows
tiff:timestamp: 2009:08:05 09:00:11
xap:CreateDate: 2008-08-07T16:49:26-07:00
xap:CreatorTool: Adobe Photoshop CS3 Windows
xap:MetadataDate: 2009-08-05T09:00:11-07:00
xap:ModifyDate: 2009-08-05T09:00:11-07:00
xapMM:InstanceID: uuid:47438E07D981DE1182B4F95825D23362
Profiles:
Profile-8bim: 8110 bytes
Profile-iptc: 8 bytes
unknown[2,0]:
Profile-xmp: 15193 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 2.133mb
Number pixels: 965mb
Pixels per second: 2.218mb
User time: 7.800u
Elapsed time: 7:16
Version: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
Thanks,
John
Re: Output of Convert is larger than expected
Here is the output from identify -verbose for new.tiff
Image: new.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 42835x23622+0+0
Resolution: 8000x8000
Print size: 5.35438x2.95275
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: MSB
Colorspace: RGB
Depth: 1-bit
Channel depth:
gray: 1-bit
alpha: 1-bit
Channel statistics:
gray:
min: 0 (0)
max: 1 (1)
mean: 0.942907 (0.942907)
standard deviation: 0.23202 (0.23202)
kurtosis: 12.5759
skewness: -3.81784
alpha:
min: 0 (0)
max: 1 (1)
mean: 0.999953 (0.999953)
standard deviation: 0.00683291 (0.00683291)
kurtosis: 21412.5
skewness: 146.337
Alpha: rgba(255,255,255,0) #FFFFFF00
Histogram:
954032037: (255,255,255,255) #FFFFFF white
57769089: ( 0, 0, 0,255) #000000 black
47244: (255,255,255, 0) #FFFFFF00 rgba(255,255,255,0)
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Page geometry: 42835x23622+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
create-date: 2009-08-11T15:45:47-07: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;2CD38CC7E1796CA1945ED3FC66338B1B
exif:PixelXDimension: 42835
exif:PixelYDimension: 23622
modify-date: 2009-08-11T16:27:21-07:00
photoshop:ColorMode: 0
photoshop:History: 2008-08-15T09:06:57-07:00 File A1_orig_M.tif opened
2008-08-15T09:07:12-07:00 File A1_orig_M.tif saved
2008-08-15T09:24:13-07:00 File A1_orig_M.tif saved
signature: 79f24cbf270625d105fb894de15cc2052989e8a7a85b55ca20d21c75604c7658
tiff:alpha: unassociated
tiff:Compression: 5
tiff:document: new.tiff
tiff:ImageLength: 23622
tiff:ImageWidth: 42835
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;8D789BB452CE27B56CEE2C2B2617180D
tiff:Orientation: 1
tiff:PhotometricInterpretation: 0
tiff:rows-per-strip: 1
tiff:SamplesPerPixel: 1
tiff:software: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
tiff:timestamp: 2009:08:05 09:00:11
xap:CreateDate: 2008-08-07T16:49:26-07:00
xap:CreatorTool: Adobe Photoshop CS3 Windows
xap:MetadataDate: 2009-08-05T09:00:11-07:00
xap:ModifyDate: 2009-08-05T09:00:11-07:00
xapMM:InstanceID: uuid:47438E07D981DE1182B4F95825D23362
Profiles:
Profile-8bim: 8110 bytes
Profile-iptc: 12 bytes
unknown[2,0]:
Profile-xmp: 15193 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 6.521mb
Number pixels: 965mb
Pixels per second: 7.129mb
User time: 9.157u
Elapsed time: 2:16
Version: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
Any ideas would be appreciated.
Thanks,
John
Image: new.tiff
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 42835x23622+0+0
Resolution: 8000x8000
Print size: 5.35438x2.95275
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: MSB
Colorspace: RGB
Depth: 1-bit
Channel depth:
gray: 1-bit
alpha: 1-bit
Channel statistics:
gray:
min: 0 (0)
max: 1 (1)
mean: 0.942907 (0.942907)
standard deviation: 0.23202 (0.23202)
kurtosis: 12.5759
skewness: -3.81784
alpha:
min: 0 (0)
max: 1 (1)
mean: 0.999953 (0.999953)
standard deviation: 0.00683291 (0.00683291)
kurtosis: 21412.5
skewness: 146.337
Alpha: rgba(255,255,255,0) #FFFFFF00
Histogram:
954032037: (255,255,255,255) #FFFFFF white
57769089: ( 0, 0, 0,255) #000000 black
47244: (255,255,255, 0) #FFFFFF00 rgba(255,255,255,0)
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Page geometry: 42835x23622+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
create-date: 2009-08-11T15:45:47-07: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;2CD38CC7E1796CA1945ED3FC66338B1B
exif:PixelXDimension: 42835
exif:PixelYDimension: 23622
modify-date: 2009-08-11T16:27:21-07:00
photoshop:ColorMode: 0
photoshop:History: 2008-08-15T09:06:57-07:00 File A1_orig_M.tif opened
2008-08-15T09:07:12-07:00 File A1_orig_M.tif saved
2008-08-15T09:24:13-07:00 File A1_orig_M.tif saved
signature: 79f24cbf270625d105fb894de15cc2052989e8a7a85b55ca20d21c75604c7658
tiff:alpha: unassociated
tiff:Compression: 5
tiff:document: new.tiff
tiff:ImageLength: 23622
tiff:ImageWidth: 42835
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;8D789BB452CE27B56CEE2C2B2617180D
tiff:Orientation: 1
tiff:PhotometricInterpretation: 0
tiff:rows-per-strip: 1
tiff:SamplesPerPixel: 1
tiff:software: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
tiff:timestamp: 2009:08:05 09:00:11
xap:CreateDate: 2008-08-07T16:49:26-07:00
xap:CreatorTool: Adobe Photoshop CS3 Windows
xap:MetadataDate: 2009-08-05T09:00:11-07:00
xap:ModifyDate: 2009-08-05T09:00:11-07:00
xapMM:InstanceID: uuid:47438E07D981DE1182B4F95825D23362
Profiles:
Profile-8bim: 8110 bytes
Profile-iptc: 12 bytes
unknown[2,0]:
Profile-xmp: 15193 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 6.521mb
Number pixels: 965mb
Pixels per second: 7.129mb
User time: 9.157u
Elapsed time: 2:16
Version: ImageMagick 6.5.3-3 2009-06-04 Q8 OpenMP http://www.imagemagick.org
Any ideas would be appreciated.
Thanks,
John
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Output of Convert is larger than expected
one difference that I see is that your new one has an alpha channel and the old one does not.
add -alpha off when processing the new one and see if that makes it smaller.
add -alpha off when processing the new one and see if that makes it smaller.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Output of Convert is larger than expected
second issue is that new image has both an 8-bit and a 12-bit profile and the old one has only an 8-bit profile.
Do you need the profiles? If not add -strip to your command line for processing both and see what happens to the file sizes.
Do you need the profiles? If not add -strip to your command line for processing both and see what happens to the file sizes.
Re: Output of Convert is larger than expected
Thanks a bunch. Using -alpha off solved most of my problem. I have a much smaller file
that I can utilize.
Thanks,
John
that I can utilize.
Thanks,
John