Links

Categories

Tags


« | Main | »

Presenting: IrfanView Filter Sandbox

By Jewe | June 8, 2013

Introducing the IrfanView Filter Sandbox plug-in.

Deutsche Version hier klicken.

Introduction

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.

IrfanView Sandbox 1

 

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.

To preserve memory resources, the plug-in will eventually purge the undo history when applying multiple effects on the image. The number of undo buffers maintained by the Sandbox depends on the size of the actual image. If you cannot undo a change to the image from within the Sandbox, you may close the plug-in and have IrfanView undo all changes made by the plug-in.

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.

IrfanView Sandbox 3

 

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.

IrfanView Sandbox 2

 

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.

While JewelScript is robust and safe, I’m not going to challenge anyone to prove me wrong. It is a simple truth in software engineering, that if you put enough energy into it, you can get any software to crash. If you find a way to crash JewelScript, I encourage you to tell me about it, so I can fix it.

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 compiler may not be able to detect all programming errors. Some errors are dynamic in nature and can only be detected at run time. If a serious error is detected during run time, JewelScript will abort script execution and present a window containing a crash log. The log may help you find the cause of the error.

IrfanView Sandbox 5

 

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.

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.

While I have taken all precautions I can think off to make the Sandbox safe and robust, there still may be things that users with malicious intent could exploit. Some of these things can certainly be fixed once I learn about them, but there will remain those which cannot be avoided.

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:

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.

Download

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 1.3.0.16. 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.

More Information

Topics: filter sandbox, news | Comments Off on Presenting: IrfanView Filter Sandbox

Comments are closed.