How to extract a page from a multipage tiff without decompressing?
Posted: 2016-10-09T05:14:55-07:00
Dear all,
I have thousands of multipage tiff images which are compressed with JPEG. From time to time, I have to extract a single page from one of these documents.
My question is: How can I extract a single page from a multipage tiff which is JPEG-compressed without decomressing the single page?
An example: I have two tiff files of 25 MB each. Using IM, I join them to a multipage tiff using JPEG compression. The new multipage tiff is then about 4 MB. If I then use IM to extract one page from the new multipage tiff, the resulting file again is 25 MB (like the original one) instead of about 2 MB like expected.
This means that IM decompresses the page when extracting. This is not what I would like to do. I would like to extract the page (which already is compressed) in unaltered form.
I know that there are multiple other threads dealing with multipage tiffs, but only a few of them deal with JPEG compression, and I have only found one thread with an answer to this question (https://www.imagemagick.org/discourse-s ... hp?t=23053). Unfortunately, the answer does not work for me (see below).
This is on Windows 7 Pro x64 with the following version of IM:
Transcript of session showing the problem:
I would be very grateful I somebody could help me out there ...
Thank you very much,
Peter
I have thousands of multipage tiff images which are compressed with JPEG. From time to time, I have to extract a single page from one of these documents.
My question is: How can I extract a single page from a multipage tiff which is JPEG-compressed without decomressing the single page?
An example: I have two tiff files of 25 MB each. Using IM, I join them to a multipage tiff using JPEG compression. The new multipage tiff is then about 4 MB. If I then use IM to extract one page from the new multipage tiff, the resulting file again is 25 MB (like the original one) instead of about 2 MB like expected.
This means that IM decompresses the page when extracting. This is not what I would like to do. I would like to extract the page (which already is compressed) in unaltered form.
I know that there are multiple other threads dealing with multipage tiffs, but only a few of them deal with JPEG compression, and I have only found one thread with an answer to this question (https://www.imagemagick.org/discourse-s ... hp?t=23053). Unfortunately, the answer does not work for me (see below).
This is on Windows 7 Pro x64 with the following version of IM:
Code: Select all
X:\Scans (temp)>magick -version
Version: ImageMagick 7.0.3-3 Q16 x64 2016-10-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
Code: Select all
X:\Scans (temp)\test>dir
Volume in drive X has no label.
Volume Serial Number is 307E-16E3
Directory of X:\Scans (temp)\test
09.10.2016 14:04 <DIR> .
09.10.2016 14:04 <DIR> ..
09.10.2016 08:45 26.120.362 Scan0936.tif
09.10.2016 11:54 26.120.362 Scan0937.tif
2 File(s) 52.240.724 bytes
2 Dir(s) 107.199.389.696 bytes free
X:\Scans (temp)\test>magick convert -compress jpeg -quality 70 Scan0936.tif Scan0937.tif multipage.tif
X:\Scans (temp)\test>dir
Volume in drive X has no label.
Volume Serial Number is 307E-16E3
Directory of X:\Scans (temp)\test
09.10.2016 14:08 <DIR> .
09.10.2016 14:08 <DIR> ..
09.10.2016 14:08 3.766.898 multipage.tif
09.10.2016 08:45 26.120.362 Scan0936.tif
09.10.2016 11:54 26.120.362 Scan0937.tif
3 File(s) 56.007.622 bytes
2 Dir(s) 107.192.328.192 bytes free
X:\Scans (temp)\test>magick convert multipage.tif[0] page_1.tif
X:\Scans (temp)\test>magick convert multipage.tif series-%d.tif
X:\Scans (temp)\test>dir
Volume in drive X has no label.
Volume Serial Number is 307E-16E3
Directory of X:\Scans (temp)\test
09.10.2016 14:10 <DIR> .
09.10.2016 14:10 <DIR> ..
09.10.2016 14:08 3.766.898 multipage.tif
09.10.2016 14:10 26.092.396 page_1.tif
09.10.2016 08:45 26.120.362 Scan0936.tif
09.10.2016 11:54 26.120.362 Scan0937.tif
09.10.2016 14:10 26.092.396 series-0.tif
09.10.2016 14:10 26.092.396 series-1.tif
6 File(s) 134.284.810 bytes
2 Dir(s) 107.114.037.248 bytes free
Thank you very much,
Peter