By Jewe | June 8, 2013
Introducing the IrfanView Filter Sandbox plug-in.
Windows users generally cherish IrfanView, the free, light-weight, fast and yet feature rich image viewer. Personally, I know of no PC where the little companion is not installed.
So I wanted to make a JewelScript plug-in for IrfanView. I wanted to enable users to easily program and share image filters and effects. Making it much easier to experiment with new effects than it would be in C or C++. The result of this is the IrfanView Filter Sandbox.
The Scripts page
This is the main page of the plug-in and is always shown after starting up. When starting up, the plug-in will scan the user’s script folder and compile a list of available effects. When selecting an effect from the list, a description is shown next to it.
To close the plug-in, click the Close button at the bottom or hit the escape key. To run the currently selected effect, click the Start button or press the return key. After the effect has been applied to the image, IrfanView will show the result in it’s main window. If you are not satisfied with the result, click the Undo button or hit Ctrl + Z. The plug-in keeps track of all changes to the image. If you have applied multiple effects, you can undo every change separately.
The following image has been made by using only the plug-in’s default effects. First, a red star has been created on a white background using “Supershapes”. Then noise and speckles have been added using the “Image Cook” effect. Finally, to slightly blur the result, “Displacement Blur” has been applied.
The Parameters page
Effects with “hard coded” values would not be very useful, so there is a mechanism for effects to define any amount of parameters. The plug-in will use this information to create a settings page for the effect once the user selects it. To view the settings page, click on the Parameters button in the top row of buttons. This will switch from the Scripts page to the Parameters page.
The page will only show the settings of the currently selected effect. You can click on the arrow down button next to the effect name in the second row to select a different effect. Your settings for the current effect will be kept in memory and still be there if you return to it.
At the moment, there are two types of parameters: Slider and Label. Depending on which type the effect is using, the sandbox will create a different control on the GUI. I’m planning to add more parameter types as the plug-in evolves. For example, a text input box and a color picker would be useful.
The Messages page
Don’t be afraid of experimenting and modifying any of the demo effects, that’s what they are for. Even if you are not an experienced programmer, the Sandbox should not crash on you if you make a mistake.
If an effect should disappear from the list of available effects, this is probably because of an error somewhere in a script. If multiple effects reside in the same file and the file has an error, it also can happen that multiple effects vanish from the list.
To check for errors in scripts, you can switch to the Messages page by clicking the button at the top. The page will tell you the file name, and in parentheses, the line number and column of the error.
The utility menu
Hidden away in the arrow down button at the top of the window, there’s the utility menu. This menu offers some additional functions that make using the plug-in more convenient.
- Edit script – This will open the script file of the currently selected effect in an external editor. By default, this will be Windows Notepad. You can change this to any other editor during the First Time Setup of the plug-in. We recommend using Notepad++ for editing scripts.
- Recycle script – Moves the script file of the currently selected effect to the trash bin. Since a script file may contain multiple effects, this may also move other effects to the trash. To undo this, open your trash bin in Windows-Explorer and choose “Restore”. Then choose Recompile from the utility menu of the Sandbox.
- Explore – This will open your script folder in Windows-Explorer. If you add or delete files in this folder, use Recompile to update the plug-in’s list of effects.
- Show log file – Opens the compiler’s log file in an external editor. If no errors have occurred during the last compilation or during run time, there will be little useful information in this file.
- Recompile – Will scan your script folder again and recompile any script that has changed. This is especially useful while you’re developing a new effect, to make your changes available for testing. You can also hit F5 to do this. If you also hold down the Control-key, this will force recompiling all scripts.
- Redo setup – This will redo the First Time Setup procedure. It’s useful if you ever decide to move your script folder to a different location or change other settings of the plug-in. The Sandbox will not copy your existing scripts over to the new location. Also, it will create new default scripts in the new location. If you have made changes to these files, you need to overwrite the default files with your edited copies. It is best to never edit these files and instead put your effects into your own files.
Installing new scripts
One of the strongest points of implementing effects in script is that users can easily make effects for users. If someone’s effect almost does what you need, you or anyone else can easily modify it to do exactly what you need. However, this power goes hand in hand with some responsibility.
The easiest way to implement an effect with malicious intent is by simply doing an infinite loop. This will make the plug-in “hang” until you use Windows Task Manager to forcefully terminate IrfanView.
Because infinite loops are a valid element of a programming language, I cannot simply remove them. JewelScript allows features where infinite loops are actually very useful (co-function threads) and may even be required. And this is only one example. If I would eliminate all language features that could potentially be abused, there would be nothing left to code an effect with.
Therefore, when you download scripts for IrfanView Sandbox, it is your responsibility to protect yourself from malicious content. These are a few general rules you should apply:
- Only download scripts from sources you trust.
- Only install scripts if you actually need them and actually know what they are doing.
- Before installation, open the file in any text editor and check what it does, or have someone you trust do that.
Installing the script is simple and straightforward. Just copy the file into your script folder. Some scripts may come with additional resources, for example image files that are used as textures. These need to be copied into your script folder as well.
The plug-in is included in the official IrfanView plugins package. But you may download the latest update here.
The latest version of IrfanView Sandbox is 18.104.22.168. This version requires IrfanView 4.40 to run.
Download for 32-bit Windows (requires 32-bit version of IrfanView)
Download for 64-bit Windows (requires 64-bit version of IrfanView)
Simply extract the downloaded ZIP archive into your IrfanView / Plugins directory. Please do this while IrfanView is not running.
Comments are closed.