Imagemagick jpeg compression failing to convert some TIFF to Pyramid TIFF, but not allReplace transparency in PNG images with white backgroundFile Format Conversion to TIFF. Some issues?JPEG in TIFF encodingHow to create pyramid tiled TIFF from JPEG image in lossless wayRecommendation for compressing JPG files with ImageMagickExtract JPEG from TIFF fileHow to update GeoTiff tag using gdal python binding?tiff() resolution and compression are not reliably set in OSXMontage / Join 2 TIFF images in a 2 col x 1 row tile without losing qualityTIFF plot generation and compression: R vs. GIMP vs. IrfanView vs. Photoshop file sizesJPEG Compression Quality using CGImage

Is this toilet slogan correct usage of the English language?

How can I block email signup overlays or javascript popups in Safari?

Has any country ever had 2 former presidents in jail simultaneously?

What should you do if you miss a job interview (deliberately)?

What is Cash Advance APR?

What should you do when eye contact makes your subordinate uncomfortable?

How do I color the graph in datavisualization?

Open a doc from terminal, but not by its name

Redundant comparison & "if" before assignment

Closed-form expression for certain product

Loading commands from file

Why Shazam when there is already Superman?

How to implement a feedback to keep the DC gain at zero for this conceptual passive filter?

A social experiment. What is the worst that can happen?

Is it better practice to read straight from sheet music rather than memorize it?

If a character has darkvision, can they see through an area of nonmagical darkness filled with lightly obscuring gas?

How to explain what's wrong with this application of the chain rule?

lightning-datatable row number error

What was this official D&D 3.5e Lovecraft-flavored rulebook?

If magnesium reacts with oxygen to produce magnesium oxide only on the application of heat, then why isn't it categorised as an endothermic reaction?

How should I respond when I lied about my education and the company finds out through background check?

Creepy dinosaur pc game identification

Fear of getting stuck on one programming language / technology that is not used in my country

Symbol used to indicate indivisibility



Imagemagick jpeg compression failing to convert some TIFF to Pyramid TIFF, but not all


Replace transparency in PNG images with white backgroundFile Format Conversion to TIFF. Some issues?JPEG in TIFF encodingHow to create pyramid tiled TIFF from JPEG image in lossless wayRecommendation for compressing JPG files with ImageMagickExtract JPEG from TIFF fileHow to update GeoTiff tag using gdal python binding?tiff() resolution and compression are not reliably set in OSXMontage / Join 2 TIFF images in a 2 col x 1 row tile without losing qualityTIFF plot generation and compression: R vs. GIMP vs. IrfanView vs. Photoshop file sizesJPEG Compression Quality using CGImage













0















I am using the following loop convert about 250 .tif files to tiled pyramid .tif file, each file is about 15 to 35 mb:



for i in *.tif; do convert $i -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:tiled-'$i; done



This is working for probably a little over half of the images: I get a compressed, tiled .tif file at about 1/4 the size of the original. For the ones that aren't working, I am getting an image file outputted that's probably about 4,000 bytes large and the one error that seems to pop with -debug all is Bogus input colorspace. "JPEGLib". These images do not appear if piped through IIP Image Server and won't open in an image viewer.



I have localized it to perhaps the -compress jpeg argument. If I run without compression, or a lossless compression like -compress LossLess JPEG, it appears to work, but the tiled images are (obviously) larger than the original, which is what I am trying to avoid.



running tiffinfo against an image that doesn't convert against an image that does I get:



Broken



$ tiffinfo WH-001.tif
TIFF Directory at offset 0x106842c (17204268)
Image Width: 1735 Image Length: 2479
Resolution: 72, 72 pixels/inch
Bits/Sample: 8
Compression Scheme: None
Photometric Interpretation: RGB color
Extra Samples: 1<unassoc-alpha>
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 4
Rows/Strip: 1
Planar Configuration: single image plane
Page Number: 0-1
DocumentName: WH-001.tif


Working



$ tiffinfo WH-090.tif
TIFFReadDirectory: Warning, Unknown field with tag 32934 (0x80a6) encountered.
TIFF Directory at offset 0xd4 (212)
Subfile Type: (0 = 0x0)
Image Width: 2800 Image Length: 4160
Resolution: 600, 600 pixels/inch
Bits/Sample: 8
Compression Scheme: None
Photometric Interpretation: RGB color
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 3
Planar Configuration: single image plane
Software: Oi/GFS, writer v00.06.02
Tag 32934: 0
ICC Profile: <present>, 3144 bytes


Though I am not sure how to tell why the one is broken and why the other one works.










share|improve this question




























    0















    I am using the following loop convert about 250 .tif files to tiled pyramid .tif file, each file is about 15 to 35 mb:



    for i in *.tif; do convert $i -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:tiled-'$i; done



    This is working for probably a little over half of the images: I get a compressed, tiled .tif file at about 1/4 the size of the original. For the ones that aren't working, I am getting an image file outputted that's probably about 4,000 bytes large and the one error that seems to pop with -debug all is Bogus input colorspace. "JPEGLib". These images do not appear if piped through IIP Image Server and won't open in an image viewer.



    I have localized it to perhaps the -compress jpeg argument. If I run without compression, or a lossless compression like -compress LossLess JPEG, it appears to work, but the tiled images are (obviously) larger than the original, which is what I am trying to avoid.



    running tiffinfo against an image that doesn't convert against an image that does I get:



    Broken



    $ tiffinfo WH-001.tif
    TIFF Directory at offset 0x106842c (17204268)
    Image Width: 1735 Image Length: 2479
    Resolution: 72, 72 pixels/inch
    Bits/Sample: 8
    Compression Scheme: None
    Photometric Interpretation: RGB color
    Extra Samples: 1<unassoc-alpha>
    FillOrder: msb-to-lsb
    Orientation: row 0 top, col 0 lhs
    Samples/Pixel: 4
    Rows/Strip: 1
    Planar Configuration: single image plane
    Page Number: 0-1
    DocumentName: WH-001.tif


    Working



    $ tiffinfo WH-090.tif
    TIFFReadDirectory: Warning, Unknown field with tag 32934 (0x80a6) encountered.
    TIFF Directory at offset 0xd4 (212)
    Subfile Type: (0 = 0x0)
    Image Width: 2800 Image Length: 4160
    Resolution: 600, 600 pixels/inch
    Bits/Sample: 8
    Compression Scheme: None
    Photometric Interpretation: RGB color
    FillOrder: msb-to-lsb
    Orientation: row 0 top, col 0 lhs
    Samples/Pixel: 3
    Rows/Strip: 3
    Planar Configuration: single image plane
    Software: Oi/GFS, writer v00.06.02
    Tag 32934: 0
    ICC Profile: <present>, 3144 bytes


    Though I am not sure how to tell why the one is broken and why the other one works.










    share|improve this question


























      0












      0








      0








      I am using the following loop convert about 250 .tif files to tiled pyramid .tif file, each file is about 15 to 35 mb:



      for i in *.tif; do convert $i -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:tiled-'$i; done



      This is working for probably a little over half of the images: I get a compressed, tiled .tif file at about 1/4 the size of the original. For the ones that aren't working, I am getting an image file outputted that's probably about 4,000 bytes large and the one error that seems to pop with -debug all is Bogus input colorspace. "JPEGLib". These images do not appear if piped through IIP Image Server and won't open in an image viewer.



      I have localized it to perhaps the -compress jpeg argument. If I run without compression, or a lossless compression like -compress LossLess JPEG, it appears to work, but the tiled images are (obviously) larger than the original, which is what I am trying to avoid.



      running tiffinfo against an image that doesn't convert against an image that does I get:



      Broken



      $ tiffinfo WH-001.tif
      TIFF Directory at offset 0x106842c (17204268)
      Image Width: 1735 Image Length: 2479
      Resolution: 72, 72 pixels/inch
      Bits/Sample: 8
      Compression Scheme: None
      Photometric Interpretation: RGB color
      Extra Samples: 1<unassoc-alpha>
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 4
      Rows/Strip: 1
      Planar Configuration: single image plane
      Page Number: 0-1
      DocumentName: WH-001.tif


      Working



      $ tiffinfo WH-090.tif
      TIFFReadDirectory: Warning, Unknown field with tag 32934 (0x80a6) encountered.
      TIFF Directory at offset 0xd4 (212)
      Subfile Type: (0 = 0x0)
      Image Width: 2800 Image Length: 4160
      Resolution: 600, 600 pixels/inch
      Bits/Sample: 8
      Compression Scheme: None
      Photometric Interpretation: RGB color
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 3
      Rows/Strip: 3
      Planar Configuration: single image plane
      Software: Oi/GFS, writer v00.06.02
      Tag 32934: 0
      ICC Profile: <present>, 3144 bytes


      Though I am not sure how to tell why the one is broken and why the other one works.










      share|improve this question
















      I am using the following loop convert about 250 .tif files to tiled pyramid .tif file, each file is about 15 to 35 mb:



      for i in *.tif; do convert $i -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:tiled-'$i; done



      This is working for probably a little over half of the images: I get a compressed, tiled .tif file at about 1/4 the size of the original. For the ones that aren't working, I am getting an image file outputted that's probably about 4,000 bytes large and the one error that seems to pop with -debug all is Bogus input colorspace. "JPEGLib". These images do not appear if piped through IIP Image Server and won't open in an image viewer.



      I have localized it to perhaps the -compress jpeg argument. If I run without compression, or a lossless compression like -compress LossLess JPEG, it appears to work, but the tiled images are (obviously) larger than the original, which is what I am trying to avoid.



      running tiffinfo against an image that doesn't convert against an image that does I get:



      Broken



      $ tiffinfo WH-001.tif
      TIFF Directory at offset 0x106842c (17204268)
      Image Width: 1735 Image Length: 2479
      Resolution: 72, 72 pixels/inch
      Bits/Sample: 8
      Compression Scheme: None
      Photometric Interpretation: RGB color
      Extra Samples: 1<unassoc-alpha>
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 4
      Rows/Strip: 1
      Planar Configuration: single image plane
      Page Number: 0-1
      DocumentName: WH-001.tif


      Working



      $ tiffinfo WH-090.tif
      TIFFReadDirectory: Warning, Unknown field with tag 32934 (0x80a6) encountered.
      TIFF Directory at offset 0xd4 (212)
      Subfile Type: (0 = 0x0)
      Image Width: 2800 Image Length: 4160
      Resolution: 600, 600 pixels/inch
      Bits/Sample: 8
      Compression Scheme: None
      Photometric Interpretation: RGB color
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 3
      Rows/Strip: 3
      Planar Configuration: single image plane
      Software: Oi/GFS, writer v00.06.02
      Tag 32934: 0
      ICC Profile: <present>, 3144 bytes


      Though I am not sure how to tell why the one is broken and why the other one works.







      image image-processing imagemagick tiff tile






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 18 '15 at 9:12









      Amal G Jose

      1,8871223




      1,8871223










      asked Apr 18 '14 at 18:17









      royroy

      1,13231940




      1,13231940






















          2 Answers
          2






          active

          oldest

          votes


















          1














          I would consider using libvips instead of convert here.



          On this modest laptop with a 10k x 10k pixel JPG source, I see:



          $ /usr/bin/time -f %M:%e convert wtc.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:im.tif
          1628568:34.29


          So that's a peak of 1.6gb of memory and 34s of elapsed time.



          With libvips I see:



          $ /usr/bin/time -f %M:%e vips tiffsave wtc.jpg vips.tif --tile --pyramid --compression jpeg
          53148:1.95


          53mb of memory and 2s of elapsed time. It's 15x faster and needs 30x less memory. It makes smaller pyramids too:



          $ ls -l vips.tif im.tif 
          -rw-r--r-- 1 john john 60672180 Mar 7 23:12 im.tif
          -rw-r--r-- 1 john john 21419592 Mar 7 23:13 vips.tif


          convert does not enable YCbCr mode, so the pyramids are 3x larger. They should work fine in iipimage.



          libvips will also flatten out transparency for you automatically.



          The docs run through all the options for tiffsave:



          https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-tiffsave






          share|improve this answer
































            0














            First, make sure the "broken ones" are actually not-broken by checking they are able to open in other image viewers.



            Secondly, I agree with your suspicion that it has to do with the -compress jpeg option. The reason is that your "broken" images contain transparency (see the Extra Samples: 1<unassoc-alpha> line), and the JPEG format does not support storing the image with transparency (alpha).



            See this other post for removing transparency from an image file.






            share|improve this answer
























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23159794%2fimagemagick-jpeg-compression-failing-to-convert-some-tiff-to-pyramid-tiff-but-n%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I would consider using libvips instead of convert here.



              On this modest laptop with a 10k x 10k pixel JPG source, I see:



              $ /usr/bin/time -f %M:%e convert wtc.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:im.tif
              1628568:34.29


              So that's a peak of 1.6gb of memory and 34s of elapsed time.



              With libvips I see:



              $ /usr/bin/time -f %M:%e vips tiffsave wtc.jpg vips.tif --tile --pyramid --compression jpeg
              53148:1.95


              53mb of memory and 2s of elapsed time. It's 15x faster and needs 30x less memory. It makes smaller pyramids too:



              $ ls -l vips.tif im.tif 
              -rw-r--r-- 1 john john 60672180 Mar 7 23:12 im.tif
              -rw-r--r-- 1 john john 21419592 Mar 7 23:13 vips.tif


              convert does not enable YCbCr mode, so the pyramids are 3x larger. They should work fine in iipimage.



              libvips will also flatten out transparency for you automatically.



              The docs run through all the options for tiffsave:



              https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-tiffsave






              share|improve this answer





























                1














                I would consider using libvips instead of convert here.



                On this modest laptop with a 10k x 10k pixel JPG source, I see:



                $ /usr/bin/time -f %M:%e convert wtc.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:im.tif
                1628568:34.29


                So that's a peak of 1.6gb of memory and 34s of elapsed time.



                With libvips I see:



                $ /usr/bin/time -f %M:%e vips tiffsave wtc.jpg vips.tif --tile --pyramid --compression jpeg
                53148:1.95


                53mb of memory and 2s of elapsed time. It's 15x faster and needs 30x less memory. It makes smaller pyramids too:



                $ ls -l vips.tif im.tif 
                -rw-r--r-- 1 john john 60672180 Mar 7 23:12 im.tif
                -rw-r--r-- 1 john john 21419592 Mar 7 23:13 vips.tif


                convert does not enable YCbCr mode, so the pyramids are 3x larger. They should work fine in iipimage.



                libvips will also flatten out transparency for you automatically.



                The docs run through all the options for tiffsave:



                https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-tiffsave






                share|improve this answer



























                  1












                  1








                  1







                  I would consider using libvips instead of convert here.



                  On this modest laptop with a 10k x 10k pixel JPG source, I see:



                  $ /usr/bin/time -f %M:%e convert wtc.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:im.tif
                  1628568:34.29


                  So that's a peak of 1.6gb of memory and 34s of elapsed time.



                  With libvips I see:



                  $ /usr/bin/time -f %M:%e vips tiffsave wtc.jpg vips.tif --tile --pyramid --compression jpeg
                  53148:1.95


                  53mb of memory and 2s of elapsed time. It's 15x faster and needs 30x less memory. It makes smaller pyramids too:



                  $ ls -l vips.tif im.tif 
                  -rw-r--r-- 1 john john 60672180 Mar 7 23:12 im.tif
                  -rw-r--r-- 1 john john 21419592 Mar 7 23:13 vips.tif


                  convert does not enable YCbCr mode, so the pyramids are 3x larger. They should work fine in iipimage.



                  libvips will also flatten out transparency for you automatically.



                  The docs run through all the options for tiffsave:



                  https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-tiffsave






                  share|improve this answer















                  I would consider using libvips instead of convert here.



                  On this modest laptop with a 10k x 10k pixel JPG source, I see:



                  $ /usr/bin/time -f %M:%e convert wtc.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:im.tif
                  1628568:34.29


                  So that's a peak of 1.6gb of memory and 34s of elapsed time.



                  With libvips I see:



                  $ /usr/bin/time -f %M:%e vips tiffsave wtc.jpg vips.tif --tile --pyramid --compression jpeg
                  53148:1.95


                  53mb of memory and 2s of elapsed time. It's 15x faster and needs 30x less memory. It makes smaller pyramids too:



                  $ ls -l vips.tif im.tif 
                  -rw-r--r-- 1 john john 60672180 Mar 7 23:12 im.tif
                  -rw-r--r-- 1 john john 21419592 Mar 7 23:13 vips.tif


                  convert does not enable YCbCr mode, so the pyramids are 3x larger. They should work fine in iipimage.



                  libvips will also flatten out transparency for you automatically.



                  The docs run through all the options for tiffsave:



                  https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-tiffsave







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 8 at 4:21

























                  answered Mar 7 at 23:28









                  jcupittjcupitt

                  4,56911522




                  4,56911522























                      0














                      First, make sure the "broken ones" are actually not-broken by checking they are able to open in other image viewers.



                      Secondly, I agree with your suspicion that it has to do with the -compress jpeg option. The reason is that your "broken" images contain transparency (see the Extra Samples: 1<unassoc-alpha> line), and the JPEG format does not support storing the image with transparency (alpha).



                      See this other post for removing transparency from an image file.






                      share|improve this answer





























                        0














                        First, make sure the "broken ones" are actually not-broken by checking they are able to open in other image viewers.



                        Secondly, I agree with your suspicion that it has to do with the -compress jpeg option. The reason is that your "broken" images contain transparency (see the Extra Samples: 1<unassoc-alpha> line), and the JPEG format does not support storing the image with transparency (alpha).



                        See this other post for removing transparency from an image file.






                        share|improve this answer



























                          0












                          0








                          0







                          First, make sure the "broken ones" are actually not-broken by checking they are able to open in other image viewers.



                          Secondly, I agree with your suspicion that it has to do with the -compress jpeg option. The reason is that your "broken" images contain transparency (see the Extra Samples: 1<unassoc-alpha> line), and the JPEG format does not support storing the image with transparency (alpha).



                          See this other post for removing transparency from an image file.






                          share|improve this answer















                          First, make sure the "broken ones" are actually not-broken by checking they are able to open in other image viewers.



                          Secondly, I agree with your suspicion that it has to do with the -compress jpeg option. The reason is that your "broken" images contain transparency (see the Extra Samples: 1<unassoc-alpha> line), and the JPEG format does not support storing the image with transparency (alpha).



                          See this other post for removing transparency from an image file.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited May 23 '17 at 12:30









                          Community

                          11




                          11










                          answered Mar 2 '15 at 18:23









                          rwongrwong

                          5,40211742




                          5,40211742



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23159794%2fimagemagick-jpeg-compression-failing-to-convert-some-tiff-to-pyramid-tiff-but-n%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

                              Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                              List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229