PDA

View Full Version : . how to save image using a script



fanfan
02.02.2013, 06:15 PM
Hi + salutations

This is may first post

OS: Windows XP
IVU version: .35 (the latest)



...\i_view32.exe u:\p.jpg /effect=(8,6)

the above script works
except I don not know how to save the modified image, scriptically.


Saving sans manual interaction is crucial !
Why ?
because, eventually, I may put the above script in a cmd 'for loop', like :

for %f in (10,20,30,40,50,60) do ...\i_view32.exe u:\p.jpg /effect=(8,%f)

Additionally,
I have zillions of images.

Mij
03.02.2013, 12:14 AM
Just add
/convert=u:\p.jpg (or whatever you want to save it as)
to the end of the line

In your loop you could probably use something like
/convert=u:\p_%f.jpg
so that all the saved files have different names.

fanfan
07.02.2013, 03:31 PM
Thanks Mij

your helpful reply did work
after a struggle:
CAVEATs:
1-all file names in a script seem to need an absolute path !!!
2-for every PNG image
i had to click on the background color i choose to make transparent.
i always choose black for all images.
So there was some annoying obligatory interaction

Two (related ?) questions:

1- Is there a list of what is/NOT
scriptable in IRFANVIEW ?

2- How to, scriptically,
designate a color (say black) in a directory of PNG images
as background ?

Mij
07.02.2013, 11:18 PM
Yes you are correct that a script needs a full path name for both the Irfanview EXE file and the image file that it is to open. That is not an Irfanview requirement. It is the script host program that requires it. You do not necessarily need a full path name in the command options that are passed to Irfanview though. If you just have /convert=p.png for example, then Irfanview will assume that you want the output file in the folder where the image file was opened. You can also use a single period (.) to represent the folder where the Irfanview program i_view32.exe resides, or a double period (..) for its parent folder. That can be useful when you have everything, i.e. a copy of the program and all the images, together on a USB stick.

As to your questions;
1. The Help file contains the list and examples of all the command line options that Irfanview can accept from the script. What code you can put into the script to generate those command line options depends on what type of script you use. Irfanview cannot pass back variables to the script. Some of the options can save output information in a file though.

2. When you save a PNG file you can set the PNG Save option (in the GUI) to use the Main Window color as the transparent color. You then do not need to select a color each time. You cannot change it using a script file unless you include in it code to edit the Irfanview initialisation file (i_view32.ini).
Be aware though that if you open a jpg file to convert to a png, the image will contain many different shades of the background color in it and only one of them can be the same as the main window color. So it will not do what you probably want it to.