command line - Batch processing multi-TIFF in Irfan view

25
2014-04
  • hemalshah

    I have to convert DPI of more than 5k Tiff images on a monthly basis from 200x200 to 100x100. I can do that in Irfan view using a .bat file that i have created.. the following is the .BAT file code

    @"c:\program files\irfanview\i_view32.exe" "e:\batch1*.tif /aspectratio /resample /tifc=4 /dpi=(100,100) /convert=e:\batch2*.tif" %*

    Where tifc=4 is Fax 4 compression

    However, the above code doesn't help me change the DPI for other pages except for Only the first page in the tiff thats getting converted to 100 DPI. Rest all pages are still 200 DPI. I am using WinXP Professional and Irfan View. Can anyone tell me what I am missing. Or any other alternative program where I can create a .bat file and run the batch process using Command line?

  • Answers
  • nixda

    Convert multiple images per command line

    Use nconvert with its infinite possibilities.

    NConvert is a batch utility for converting graphic files.

    • Import about 400 graphic file formats
    • Export about 40 graphic file formats
    • Multipage TIFF, Animated GIF, Animated ICO support
    • Resize
    • Adjust brightness, contrast...
    • Modify number of colors
    • Apply filters (blur, average, emboss, ...)
    • Apply effects (lens, wave, ...)
    • And many many other things

    Read this User guide for some examples to start.
    I uploaded the full help file on pastebin to see what parameters are available

    Note: A graphical front-end using nconvert is XnConvert


    To answer hemalshah' initial question

    1. download nconvert and place it somewhere
    2. create a .cmd in the same folder and copy&paste the following command
    3. Customize the path to your own .tiff image and execute the batch file.
      This will create a new mysource_1.tiff file in the source folder (use -overwrite to replace the original)

    nconvert -out tiff -multi -dpi 100 -c 4 -keepdocsize -keepfiledate mysource.tif

    • this can easily be expanded to convert thousands of files at once.
      Nconvert understands textfiles with image paths as input
    • -out tiff -multi is necessary to tell nconvert to produce multi-page TIFF files
    • -dpi 100 obviously sets the new DPI
    • -keepdocsize preserves your page height and width
    • -keepfiledate preserves the original create date
    • -c 4 sets the compression method. I recommend ZLIB since it produces the smallest files
      Other compression methods

      1 (Rle), 2 (LZW), 3 (LZW+Prediction), 4 (ZLIB)
      5 (CCITT G3), 6 (CCITT G3-2D), 7 (CCITT G4) only B/W
      8 (JPEG) only 24/32 bits
      

    I separated the output tiff into single page tiff files to see if all pages are set to 100 DPI. As the screenshot proves, nconvert will solve your issue.

    enter image description here

  • S.gfx

    You certainly can access the setting (affect all layers for tiffs, bottom right corner) in Advanced Options at batch menu dialog. So, the functionality is already there.Wether it's already ported to command line options, I don't know, might be not documented.

    Another solution that could help (neither tried) is Imagemagick, download at www.imagemagick.org. It is a free command line editor/converter.


  • Related Question

    printer - Printing documents to tiff
  • Isaac

    I have a faxing program that only accepts TIFF files to send. It don't have any utility to convert documents to TIFF and i have to convert them myself. Even worse, it only accepts monochrome TIFF Files with 200x200 dpi and Width of 1728 pixels!

    I found Peernet TIFF Image Printer that is really perfect. It sets up a Virtual Printer and i can print anything and anywhere to TIFF format! But it is not free and i cannot pay any more extra $100 !

    Is there any software that could do it for me?

    Is there any way to install a tiff printer? I found something about ghostscript and how to setup a Virtual Tiff Printer, But i was not simple and i don't know where i should set 200x200dpi and Width=1728pixel


  • Related Answers
  • Richard

    You could try BullZip PDF Printer. It has an option for printing to TIFF and allows you to set the resolution. I'm not sure about how you would guarantee a width of 1728 pixels (probably by changing the size of the original document), but it might be worth having a look.

  • alex

    You can use PDFCreator. From the website:

    Key Features:

    • safe-to-install awardCreate PDFs from any program that is able to print
    • Security: Encrypt PDFs and protect them from being opened, printed etc
    • New: Digitally sign your PDFs to ensure that you are the author and the file has not been modified
    • New: Create PDF/A files for long term archives
    • Send generated files via eMail
    • Create more than just PDFs: PNG, JPG, TIFF, BMP, PCX, PS, EPS
    • AutoSave files to folders and filenames based on Tags like Username, Computername, Date, Time etc.
    • Merge multiple files into one PDF
    • Easy Install: Just say what you want and everything is installed
    • Terminal Server: PDFCreator also runs on Terminal Servers without problems
    • And the best: PDFCreator is free, even for commercial use! It is Open Source and released under the Terms of the GNU General Public License.
  • admintech

    I have had good experience with both

    Bullzip

    and Polestar

    Polestar is slightly better, as it allows you to specify resolution etc before you print

  • seanyboy

    A lot of PDF printers have an option to print to tiff. I haven't got one that prints to tiff installed myself, but that may be an option.

    I also found some instructions for setting up ghostscript with tiff printing. You need to add a line to the tif.rsp file to set the resolution.

    I think this is -r200. e.g.

    -Ic:\gs\gs8.00\lib;c:\gs\fonts
    -sDEVICE=tiffg4
    -sOutputFile=c:\print.tif
    -dNOPAUSE
    -dSAFER
    -dBATCH
    -sPAPERSIZE=letter
    -r200
    
  • Kurt Pfeifle

    1728 pixels width at 200dpi gives a page width of 8.64in, which translates to 622pt (PostScript points). This is roughly the width of Letter (612pt)... So what is the page height you are allowed to use? If you use Ghostscript's "tiffg4" output and specify the width in pixels, you also need to specify the height in pixels.

    Note, the above suggestion to run Ghostscript with sPAPERSIZE=letter will not create a TIFF with a width of 1728 pixels as required by you. It will use 612 PostScript points, which translate into 1720 pixels only.

    You can use Ghostscript on Windows to create the TIFF with exactly the resolution and width/height you need. Here is an example command (using a height of 2200 pixels and a width of 1728 pixels at 200dpi):

    gswin32c.exe ^
        -dBATCH ^
        -dNOPAUSE ^
        -sDEVICE=tiffg4 ^
        -dPDFFitPage ^
        -sOutputFile=c:\temp\page-%04d.tif ^
        -r200x200 ^
        -g1728x2200 ^
        c:\path\to\input\pdf