Saturday, July 09, 2011

10 Useful Command-Line IrfanView Tools For Working With Images

irfanview command line
These days, screenshot applications are a dime a dozen, and you can do image editing offline, online and even on your phone. So what’s a new way that you can make use of image editing or screenshot tools that goes beyond just opening up an app and editing images? What if you could integrate image editing directly into your batch jobs or Windows scripts?

If you’re familiar with IrfanView, and think that it’s only a simple image editor and screenshot app, then I invite you to take another look. All of the following script commands can be run from the command prompt, so long as you are working in the directory where IrfanView is installed – which is typically “C:\Program Files(x86)\IrFanView\”. All of the following commands will work from there, or you can include that directory in your system PATH variable so that the “i_view32.exe” command will be recognized no matter where you’re working from.

Running IrfanView Commands

You can find a long list of script commands from within the IrfanView application when you click on Help and search for ”command line options“. I want to point out 10 of the most powerful and useful commands that are available. You can issue these from the command prompt (or from within a Windows Script or Batch file).

Create An Instant Slideshow

The first command I want to show you is one that creates an instant slideshow from a whole bunch of pictures. These can be pictures that you have stored in a directory, or from a list of files defined in a text file. The command is as follows:

'i_view32.exe /slideshow=c:\temp\testpics\*.* /closeslideshow'

The way this works is simple. You could replace ”c:\mypictures\*.*” with “c:\mypics.txt“ if you like if you want to use a text file filled with a list of pictures with the full path for each.

irfanview command line

Pictures show up in the center of your screen on a black background. The /closeslideshow parameter tells the app to close automatically after the last picture.

The nice thing about being able to launch a slideshow with one command line is that you can display your slideshow instantly without any work. Just type the command and start scrolling!

Look At All Images In A Directory

The next command is a fast way to take a look at all images within a directory without the need to open up every one of them.

'i_view32.exe c:\temp\testpics /thumbs'

This instantly launches IrfanView in thumbnail mode, and defaults to the directory that you’ve defined.

irfanview command line options

Resize Lots Of Images At Once

The third command I want to cover is my favorite. One thing that I find annoying and time consuming is resizing a large collection of images.

Instead, just issue this command and you’re done in seconds.

'i_view32.exe c:\temp\testpics\*.jpg /resize=(200,100) /aspectratio /resample /convert=c:\temp\testpics\testsmall\*.png'

Let me break this down. The first part defines your source directory and image type. Then you define the resize parameters. The last part of the command will convert the output images to any format. In seconds, all images are done.

irfanview command line options

Send Image Collections To The Printer

The fourth command is pretty simple. Want to send a collection of images to your default printer? Just issue the following command.

'i_view32.exe c:\testpics\*.jpg /print'

Take Instant Screenshots With A File Timestamp

Another pretty cool command is one that takes an instant screenshot and saves as a file with a time stamp.

'i_view32.exe /capture=0 /convert=c:\temp\capture_$U(%d%m%Y_%H%M%S).jpg'

The capture=0 could be 1 (current monitor), 2 (foreground window), 3 (client area), 4 (rectangle section), or 5 (launch in capture mode).

irfanview command line options

Once the full screenshot is saved to file, you can email it or process it using other Windows Scripting or Batch commands. The potential of this command is pretty powerful.

Search For Images Quickly On Your Computer

The sixth command is a fast and easy way to search for images on your computer. Just type:

'i_view32.exe c:\temp\testpics\ /thumbs /filepattern='*.png''

This will open IrfanView in thumbnail mode, using the file pattern that you defined.

irfanview commands

Deny User Permissions

The next command I wanted to show you is probably the coolest. Let’s say that you’re writing a Windows Script and you want to display a picture to the user, but you don’t want to let them modify or change the file. You can accomplish this with the following command:

'i_view32.exe c:\test.jpg /hide=7'

The “hide” value is a combination of what parts of the window you want to hide. Just choose 1 (toolbar), 2 (status bar), 4 (menu bar), or 8 (caption). To combine multiple parts of the window, just add the numbers together!

irfanview commands

Be careful about using 15, because if you hide everything, the user will have no way of ever closing the window at all.

Output Text Files To A TIF File

Some other wonderfully useful commands include outputting text files to a TIF file:

'i_view32.exe c:\test.jpg /append=c:\test.tif'

irfanview commands

Create A Panorama Image

Creating a panorama image from multiple images – 1 is horizontal and 2 is vertical.

'i_view32.exe /panorama=(1,c:\pics\china1.png,c:\pics\china2.png,c:\pics\china3.png)'

Set An Image As Desktop Wallpaper

Finally, the command that could also make for a pretty good practical joke if you use the right photo, the command to set an image as the computer desktop wallpaper background.

'i_view32.exe c:\test.jpg /wall=0'

Set wall equal to 0 for a centered image, 1 to tile it, 2 to stretch it and 3 to resize the image proportionally.

irfanview command line

You can set the background image on your PC using this command much faster than the number of clicks it takes to do it otherwise. That’s the beauty of the set of command tools you get through IrfanView – you can process and manipulate images on your PC much faster and more efficiently than would ever be possible using the old point and click approach.

Give a few of these commands a try on your own PC and see if it helps you save a little time and become more productive when dealing with images. Share your thoughts and your own IrfanView command line tips in the comments section below.

No comments:

Post a Comment

[Please do not advertise, or post irrelevant links. Thank you for your cooperation.]