When I process a 16 bits per channel RGB image of pure black, ImageMagick will save it out as a smaller image of a different format. How do I prevent this? This is really messing up my pipeline.
You can find an example black.tif here http://drop.io/imagemagick
For example,
black.tif is 12,169kb in size. When I run:
convert black.tif new.tif
new.tif is 272kb in size.
Then I added this to the command line hoping it would help:
convert black.tif -depth 16 new.tif
But new.tif is only 4,073kb and the format went from RGB to GRAY when I open it in photoshop.
How do I get new.tif to save in the exact same format as black.tif?
Thanks for your help,
Drew
prevent ImageMagick from changing the image format
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: prevent ImageMagick from changing the image format
Read Anthony's Examples section on Tiff at http://www.imagemagick.org/Usage/formats/#tiff
Your problem may be due to different compression that IM may be using compared to what you have in your original file.
check your original file to see what compression is being used and all the other Tif parameters, then set them accordingly in your conversion
To check what is in black.tif use:
identify -verbose black.tif
Your problem may be due to different compression that IM may be using compared to what you have in your original file.
check your original file to see what compression is being used and all the other Tif parameters, then set them accordingly in your conversion
To check what is in black.tif use:
identify -verbose black.tif
Re: prevent ImageMagick from changing the image format
I did an Identify but I don't see any difference. Any ideas?
---------------------------------------------------------------
Here is the output for Black1.tif which is about 12 megs in size.
TIFF Directory at offset 0x0 (0)
Image Width: 1920 Image Length: 1080
Resolution: 72, 72 pixels/inch
Bits/Sample: 1
Compression Scheme: None
Photometric Interpretation: min-is-black
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 34
Planar Configuration: single image plane
DateTime: 2008:07:08 16:29:38
Software: ImageMagick 6.4.1 05/05/08 Q16 http://www.imagemagick.org
DocumentName: -identify
Photoshop Data: <present>, 2708 bytes
RichTIFFIPTC Data: <present>, 12 bytes
XMLPacket (XMP Metadata):
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:40:08 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
<tiff:ImageWidth>1920</tiff:ImageWidth>
<tiff:ImageLength>1080</tiff:ImageLength>
<tiff:BitsPerSample>
<rdf:Seq>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
</rdf:Seq>
</tiff:BitsPerSample>
<tiff:Compression>1</tiff:Compression>
<tiff:PhotometricInterpretation>2</tiff:PhotometricInterpretation>
<tiff:Orientation>1</tiff:Orientation>
<tiff:SamplesPerPixel>3</tiff:SamplesPerPixel>
<tiff:PlanarConfiguration>1</tiff:PlanarConfiguration>
<tiff:XResolution>720000/10000</tiff:XResolution>
<tiff:YResolution>720000/10000</tiff:YResolution>
<tiff:ResolutionUnit>2</tiff:ResolutionUnit>
<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;0091F86BCE7F5BC1721844F523766178</tiff:NativeDigest>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xap="http://ns.adobe.com/xap/1.0/">
<xap:CreatorTool>Adobe Photoshop CS3 Windows</xap:CreatorTool>
<xap:CreateDate>2008-07-08T16:29:17-06:00</xap:CreateDate>
<xap:ModifyDate>2008-07-08T16:29:38-06:00</xap:ModifyDate>
<xap:MetadataDate>2008-07-08T16:29:38-06:00</xap:MetadataDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>image/tiff</dc:format>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:ColorMode>3</photoshop:ColorMode>
<photoshop:History/>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#">
<xapMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>uuid:42D6504D3A4DDD1188708AF84BFC8C2A</stRef:instanceID>
<stRef:documentID>uuid:3ED6504D3A4DDD1188708AF84BFC8C2A</stRef:documentID>
</xapMM:DerivedFrom>
<xapMM:InstanceID>uuid:D189894E3D4DDD1188708AF84BFC8C2A</xapMM:InstanceID>
<xapMM:DocumentID>uuid:0804BD453B4DDD1188708AF84BFC8C2A</xapMM:DocumentID>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<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;D26A1A0A3A00216DCD408CFCD0121733</exif:NativeDigest>
<exif:PixelXDimension>1920</exif:PixelXDimension>
<exif:PixelYDimension>1080</exif:PixelYDimension>
<exif:ColorSpace>-1</exif:ColorSpace>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
black1.tif=>-identify TIFF 1920x1080 1920x1080+0+0 1-bit DirectClass 271.566kb 0.250u 0:01
---------------------------------------------------------------
Here is the output for 1.tif which is 278,080 bytes in size.
TIFF Directory at offset 0x0 (0)
Image Width: 1920 Image Length: 1080
Resolution: 72, 72 pixels/inch
Bits/Sample: 1
Compression Scheme: None
Photometric Interpretation: min-is-black
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 34
Planar Configuration: single image plane
DateTime: 2008:07:08 16:29:38
Software: ImageMagick 6.4.1 05/05/08 Q16 http://www.imagemagick.org
DocumentName: -identify
Photoshop Data: <present>, 2708 bytes
RichTIFFIPTC Data: <present>, 16 bytes
XMLPacket (XMP Metadata):
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:40:08 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
<tiff:ImageWidth>1920</tiff:ImageWidth>
<tiff:ImageLength>1080</tiff:ImageLength>
<tiff:BitsPerSample>
<rdf:Seq>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
</rdf:Seq>
</tiff:BitsPerSample>
<tiff:Compression>1</tiff:Compression>
<tiff:PhotometricInterpretation>2</tiff:PhotometricInterpretation>
<tiff:Orientation>1</tiff:Orientation>
<tiff:SamplesPerPixel>3</tiff:SamplesPerPixel>
<tiff:PlanarConfiguration>1</tiff:PlanarConfiguration>
<tiff:XResolution>720000/10000</tiff:XResolution>
<tiff:YResolution>720000/10000</tiff:YResolution>
<tiff:ResolutionUnit>2</tiff:ResolutionUnit>
<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;0091F86BCE7F5BC1721844F523766178</tiff:NativeDigest>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xap="http://ns.adobe.com/xap/1.0/">
<xap:CreatorTool>Adobe Photoshop CS3 Windows</xap:CreatorTool>
<xap:CreateDate>2008-07-08T16:29:17-06:00</xap:CreateDate>
<xap:ModifyDate>2008-07-08T16:29:38-06:00</xap:ModifyDate>
<xap:MetadataDate>2008-07-08T16:29:38-06:00</xap:MetadataDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>image/tiff</dc:format>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:ColorMode>3</photoshop:ColorMode>
<photoshop:History/>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#">
<xapMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>uuid:42D6504D3A4DDD1188708AF84BFC8C2A</stRef:instanceID>
<stRef:documentID>uuid:3ED6504D3A4DDD1188708AF84BFC8C2A</stRef:documentID>
</xapMM:DerivedFrom>
<xapMM:InstanceID>uuid:D189894E3D4DDD1188708AF84BFC8C2A</xapMM:InstanceID>
<xapMM:DocumentID>uuid:0804BD453B4DDD1188708AF84BFC8C2A</xapMM:DocumentID>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<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;D26A1A0A3A00216DCD408CFCD0121733</exif:NativeDigest>
<exif:PixelXDimension>1920</exif:PixelXDimension>
<exif:PixelYDimension>1080</exif:PixelYDimension>
<exif:ColorSpace>-1</exif:ColorSpace>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
1.tif=>-identify TIFF 1920x1080 1920x1080+0+0 1-bit PseudoClass 2c 271.57kb 0.125u 0:01
---------------------------------------------------------------
Here is the output for Black1.tif which is about 12 megs in size.
TIFF Directory at offset 0x0 (0)
Image Width: 1920 Image Length: 1080
Resolution: 72, 72 pixels/inch
Bits/Sample: 1
Compression Scheme: None
Photometric Interpretation: min-is-black
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 34
Planar Configuration: single image plane
DateTime: 2008:07:08 16:29:38
Software: ImageMagick 6.4.1 05/05/08 Q16 http://www.imagemagick.org
DocumentName: -identify
Photoshop Data: <present>, 2708 bytes
RichTIFFIPTC Data: <present>, 12 bytes
XMLPacket (XMP Metadata):
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:40:08 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
<tiff:ImageWidth>1920</tiff:ImageWidth>
<tiff:ImageLength>1080</tiff:ImageLength>
<tiff:BitsPerSample>
<rdf:Seq>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
</rdf:Seq>
</tiff:BitsPerSample>
<tiff:Compression>1</tiff:Compression>
<tiff:PhotometricInterpretation>2</tiff:PhotometricInterpretation>
<tiff:Orientation>1</tiff:Orientation>
<tiff:SamplesPerPixel>3</tiff:SamplesPerPixel>
<tiff:PlanarConfiguration>1</tiff:PlanarConfiguration>
<tiff:XResolution>720000/10000</tiff:XResolution>
<tiff:YResolution>720000/10000</tiff:YResolution>
<tiff:ResolutionUnit>2</tiff:ResolutionUnit>
<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;0091F86BCE7F5BC1721844F523766178</tiff:NativeDigest>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xap="http://ns.adobe.com/xap/1.0/">
<xap:CreatorTool>Adobe Photoshop CS3 Windows</xap:CreatorTool>
<xap:CreateDate>2008-07-08T16:29:17-06:00</xap:CreateDate>
<xap:ModifyDate>2008-07-08T16:29:38-06:00</xap:ModifyDate>
<xap:MetadataDate>2008-07-08T16:29:38-06:00</xap:MetadataDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>image/tiff</dc:format>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:ColorMode>3</photoshop:ColorMode>
<photoshop:History/>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#">
<xapMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>uuid:42D6504D3A4DDD1188708AF84BFC8C2A</stRef:instanceID>
<stRef:documentID>uuid:3ED6504D3A4DDD1188708AF84BFC8C2A</stRef:documentID>
</xapMM:DerivedFrom>
<xapMM:InstanceID>uuid:D189894E3D4DDD1188708AF84BFC8C2A</xapMM:InstanceID>
<xapMM:DocumentID>uuid:0804BD453B4DDD1188708AF84BFC8C2A</xapMM:DocumentID>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<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;D26A1A0A3A00216DCD408CFCD0121733</exif:NativeDigest>
<exif:PixelXDimension>1920</exif:PixelXDimension>
<exif:PixelYDimension>1080</exif:PixelYDimension>
<exif:ColorSpace>-1</exif:ColorSpace>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
black1.tif=>-identify TIFF 1920x1080 1920x1080+0+0 1-bit DirectClass 271.566kb 0.250u 0:01
---------------------------------------------------------------
Here is the output for 1.tif which is 278,080 bytes in size.
TIFF Directory at offset 0x0 (0)
Image Width: 1920 Image Length: 1080
Resolution: 72, 72 pixels/inch
Bits/Sample: 1
Compression Scheme: None
Photometric Interpretation: min-is-black
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 34
Planar Configuration: single image plane
DateTime: 2008:07:08 16:29:38
Software: ImageMagick 6.4.1 05/05/08 Q16 http://www.imagemagick.org
DocumentName: -identify
Photoshop Data: <present>, 2708 bytes
RichTIFFIPTC Data: <present>, 16 bytes
XMLPacket (XMP Metadata):
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:40:08 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
<tiff:ImageWidth>1920</tiff:ImageWidth>
<tiff:ImageLength>1080</tiff:ImageLength>
<tiff:BitsPerSample>
<rdf:Seq>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
<rdf:li>16</rdf:li>
</rdf:Seq>
</tiff:BitsPerSample>
<tiff:Compression>1</tiff:Compression>
<tiff:PhotometricInterpretation>2</tiff:PhotometricInterpretation>
<tiff:Orientation>1</tiff:Orientation>
<tiff:SamplesPerPixel>3</tiff:SamplesPerPixel>
<tiff:PlanarConfiguration>1</tiff:PlanarConfiguration>
<tiff:XResolution>720000/10000</tiff:XResolution>
<tiff:YResolution>720000/10000</tiff:YResolution>
<tiff:ResolutionUnit>2</tiff:ResolutionUnit>
<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;0091F86BCE7F5BC1721844F523766178</tiff:NativeDigest>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xap="http://ns.adobe.com/xap/1.0/">
<xap:CreatorTool>Adobe Photoshop CS3 Windows</xap:CreatorTool>
<xap:CreateDate>2008-07-08T16:29:17-06:00</xap:CreateDate>
<xap:ModifyDate>2008-07-08T16:29:38-06:00</xap:ModifyDate>
<xap:MetadataDate>2008-07-08T16:29:38-06:00</xap:MetadataDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>image/tiff</dc:format>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:ColorMode>3</photoshop:ColorMode>
<photoshop:History/>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#">
<xapMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>uuid:42D6504D3A4DDD1188708AF84BFC8C2A</stRef:instanceID>
<stRef:documentID>uuid:3ED6504D3A4DDD1188708AF84BFC8C2A</stRef:documentID>
</xapMM:DerivedFrom>
<xapMM:InstanceID>uuid:D189894E3D4DDD1188708AF84BFC8C2A</xapMM:InstanceID>
<xapMM:DocumentID>uuid:0804BD453B4DDD1188708AF84BFC8C2A</xapMM:DocumentID>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<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;D26A1A0A3A00216DCD408CFCD0121733</exif:NativeDigest>
<exif:PixelXDimension>1920</exif:PixelXDimension>
<exif:PixelYDimension>1080</exif:PixelYDimension>
<exif:ColorSpace>-1</exif:ColorSpace>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
1.tif=>-identify TIFF 1920x1080 1920x1080+0+0 1-bit PseudoClass 2c 271.57kb 0.125u 0:01
Re: prevent ImageMagick from changing the image format
I finally solved my problem!!!
Add this to the line:
-type TrueColor
This took me way too long to figure out.
Add this to the line:
-type TrueColor
This took me way too long to figure out.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: prevent ImageMagick from changing the image format
Your first image is directclass and the second is pseudoclass. Add -type TrueColor
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: prevent ImageMagick from changing the image format
Basically IM is trying to be helpful and generate a TIF that is 'bast' for the colors in your image. The -type forces a particularly behavior, as do many other options for TIFF (which is a very variable image file format).
First port should have been the reference to the TIFF hints and tips in IM examples .
http://www.imagemagick.org/Usage/formats/#tiff
but you should have a understand of the Basics too
http://www.imagemagick.org/Usage/basics/
which would have told you what is actually going on.
First port should have been the reference to the TIFF hints and tips in IM examples .
http://www.imagemagick.org/Usage/formats/#tiff
but you should have a understand of the Basics too
http://www.imagemagick.org/Usage/basics/
which would have told you what is actually going on.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: prevent ImageMagick from changing the image format
okay im doing a challenge for a site and can people decode this
<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;2D4121
3655C4B47A562022BF501D84AA</tiff:NativeDigest>
its apart of a challenge.... i think
<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;2D4121
3655C4B47A562022BF501D84AA</tiff:NativeDigest>
its apart of a challenge.... i think