How to "edit" Multipage Tiff's?

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

Post Reply
Co1m
Posts: 4
Joined: Thu Sep 25, 2014 10:32 am

How to "edit" Multipage Tiff's?

Post by Co1m »

Hello
i have a colored Multipage Tiff and i want to greyscale the Multipage Tiff and do some optimazations. Im trying commands like this:

Code: Select all

nconvert.exe -multi -ctype grey -dpi 100 -autocontrast C:\D3\TEMP\TEST1\Original_16MB.tif
But the only thing i get is the first Page of my Multipage Tiff. How to use the commands that alle "Settings" are done for all sites of the Multipage Tiff?

regards

Co1m
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

Co1m wrote:i have a colored Multipage Tiff and i want to greyscale the Multipage Tiff and do some optimazations...
From memory, I think the only way to do that is to first extract the images from the multi-page TIFF to a folder, then perform the operations you wish to perform on the images in the folder, and then create a new multi-page TIFF...

That would require three command lines performed successively, but you could put them all in a .bat batch file.
Co1m
Posts: 4
Joined: Thu Sep 25, 2014 10:32 am

Re: How to "edit" Multipage Tiff's?

Post by Co1m »

Hi
i found a solution by brute forcing :-D

Code: Select all

nconvert.exe -o result.tif -out tiff -multi -autocontrast -grey 16 -c 4 C:\D3\TEMP\TEST1\Original_16MB.tif
With this command you can edit all pages within the tiff.

regards

Co1m
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

Co1m wrote:Hi
i found a solution by brute forcing :-D

Code: Select all

nconvert.exe -o result.tif -out tiff -multi -autocontrast -grey 16 -c 4 C:\D3\TEMP\TEST1\Original_16MB.tif
With this command you can edit all pages within the tiff.
Thanks for posting that, I'll have a look at it in case I've missed something myself :)
Co1m
Posts: 4
Joined: Thu Sep 25, 2014 10:32 am

Re: How to "edit" Multipage Tiff's?

Post by Co1m »

Hi Again
i found out, that this solution doesn't work in all cases. I have a folder with x Multipage Tiffs. I want that they become "greyscale" and small. But i want still x Multipage tiffs, not just one.
This command edits and resizes all MultiPage-Tiff-Files into ONE big Multipage Tiff-File:

Code: Select all

nconvert.exe -o % -out tiff -multi -autocontrast -grey 16 -resize 40% 40% -c 2 C:\D3\TEMP\TEST1\*.tif
If there is just one File everything is fine. BUT, i have more than one file. Any idea how to implement this?

regards

Co1m
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

Co1m wrote:I have a folder with x Multipage Tiffs. I want that they become "greyscale" and small. But i want still x Multipage tiffs, not just one.
I think -- and I was wrong last time from memory -- you probably need to use a 'DOS' FOR loop in a batch file...
Co1m
Posts: 4
Joined: Thu Sep 25, 2014 10:32 am

Re: How to "edit" Multipage Tiff's?

Post by Co1m »

Hi
right, same conclusion here. Here is what i did:
1. create a Batch-File with this content:

Code: Select all

SET INPUT_PATH=C:\Users\kga\Desktop\SCANNER-INPUT
SET PATTERN=*.tif
SET COMMAND=cmd /c C:\D3\xnView\nconvert.exe -quiet -o C:\Users\kga\Desktop\IRFAN-OUTPUT\%% -out tiff -multi -autocontrast -grey 16 -resize 50%% 50%% -c 2

forfiles /p "%INPUT_PATH%" /m %PATTERN% /c "%COMMAND% @file"

move C:\Users\kga\Desktop\IRFAN-OUTPUT\* V:\
del /f/s/q C:\Users\kga\Desktop\SCANNER-INPUT\*
The last two lines arent necessary. I'm just moving the output to another folder and deleting the files from the input folder. I know there is the option -D but there is a Bug with it. If you use -D NConvert deletes the original-Multipage-Tif-File after processing the first Page.

This batch-file takes all TIF-files from the input directory and process them one after another (for-loop for every tiff file) and output it to the output directory. After this he takes the hole bunch of files and moves the files to a new directory.

regards

Co1m
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

Thanks for posting your solution: forfiles looks an interesting option for running NConvert repetitively on a series of files when that is necessary, and looks to have simpler syntax than the 'DOS' FOR loop.
se.semagin
Posts: 4
Joined: Wed Apr 22, 2015 11:00 am

Re: How to "edit" Multipage Tiff's?

Post by se.semagin »

Hello. I'm trying to change compression in multipage TIFF-file. Now it is LZW, but I want JPG.

Code: Select all

nconvert.exe -multi -c 8 -out tiff -o "out.tiff" "in.tiff"
After conversion the TIFF-file is WITHOUT jpeg compression. Works only for -c (1-4). Any idea?
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

Are the TIFF images 24/32 bit, not 1-bit (black and white) or 8-bit (grayscale)?
se.semagin
Posts: 4
Joined: Wed Apr 22, 2015 11:00 am

Re: How to "edit" Multipage Tiff's?

Post by se.semagin »

Are the TIFF images 24/32 bit, not 1-bit (black and white) or 8-bit (grayscale)?
8-bit
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

se.semagin wrote:
Are the TIFF images 24/32 bit, not 1-bit (black and white) or 8-bit (grayscale)?
8-bit
Although the JPG format supports 8-bit images, JPG compression for TIFF files is only supported in NConvert for 24/32 bit depths, as stated in the Help file.

You could possibly convert your TIFF files to 24-bit depth images and then save them with JPEG compression, adding a -q term to set the compression level...
se.semagin
Posts: 4
Joined: Wed Apr 22, 2015 11:00 am

Re: How to "edit" Multipage Tiff's?

Post by se.semagin »

Although the JPG format supports 8-bit images, JPG compression for TIFF files is only supported in NConvert for 24/32 bit depths, as stated in the Help file.

You could possibly convert your TIFF files to 24-bit depth images and then save them with JPEG compression, adding a -q term to set the compression level..
Thank you for help.

I've tried to convert my TIFF to 32-bit depth using

Code: Select all

-32bits
, as I can't find NConvert parameter to convert to 24 bit. Then I've tried to compress 32-bit TIFF with

Code: Select all

-c 8 and -q 80
- but no compression was added.

Got no idea what is wrong :shock: JPEG compression is supported in NConvert for 24/32 bit depths in the TIFF files , as stated in the Help file. :(
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to "edit" Multipage Tiff's?

Post by cday »

You have a multi-page TIFF file containing grayscale images that you wish to compress using JPG compression, so you need to convert to 24 or 32-bit colour depth...
se.semagin wrote:I can't find NConvert parameter to convert to 24 bit.
You could try:

Code: Select all

-truecolors
I'm not an expert on NConvert but no-one else replies ... :wink:
Last edited by cday on Fri Apr 24, 2015 6:53 am, edited 1 time in total.
se.semagin
Posts: 4
Joined: Wed Apr 22, 2015 11:00 am

Re: How to "edit" Multipage Tiff's?

Post by se.semagin »

With -truecolors work well. Thank you!
Post Reply