Back to home page

im_logo.wsf script

At the beginning im_logo.wsf script was created to automate process of scaling, and signing many pictures at once.
Next rotation was added according to image orientation information.
After that ISO image creation with converted images ability was added. ISO image need some image browser to include in it. That's why simple support for PhotoCDBrowser and jsgal was added.

im_logo.wsf   main job:

im_logo.wsf   img2pdf job:

You can download this script here.
Some common routines are placed in im_common.js file. Do not run this file directly.

All image operations are performed by ImageMagick toolkit.

This script is created to use with Total Commander. It doesn't require Total Commander but can be easly integrated with it.

Options in im_logo.wsf script have three forms:

If you run im_logo.wsf script from Windows Explorer by dobleclicking info box is displayed with basic usage info.

Two box are displayed because this script was divided in two separate jobs. For real job this script should be running from command line with cscript.exe interpreter:

main job.

cscript.exe //NoLogo //Job:main im_logo.wsf ...

Options:

Option Type Description Default value
file_list named parameter Path to text file. Each line of this file describes full path to image file.
Total Commander automatically creates this file for you (%L macro).

unnamed parameter Path to image file to process. May be specified many times. No wildcards may be used.
dest_dir named parameter Full path to destination directory. %T macro in Total Commander may be used.
No default value.
This option must be used.
logo named parameter Draw specified text on each processed file. Empty string. By default no logo will be drawn.
logo_file named parameter

Path to text file with logo text.
Instead of logo option this option may be used to take logo text from file.


font_size named parameter Font size of drawing text in points. 14
rotate named parameter Rotation angle. This option is used only for image files without orientation information. 0
orientation boolean switch Read orientation tag from EXIF image block if any and make proper rotation tasks. If this option is off off rotate option is used. +
resolution named parameter Resolution of destination image in DPI. 72
rename boolean switch Automatically rename processed files to avoid name collisions.
png boolean switch Produce PNG files instead of JPEG files.
Do not use PNG files if you want to use PhotoCDBrowser because it doesn't support this image format.
- (JPEG files)
watermark boolean switch Sign images with watermark instead of dimmed text. Watermarking is more expensive method of annotating. -
quality named parameter Quality of created JPEG destination files or compression method of PNG files. Only integer numbers are accepted from range (0..100]. 85
thumb boolean switch Create thumbnails of processed images. Thumbnails have thumb_ prefix. -
comment boolean switch Read comments from images if any.
Options pcdb and jsgal uses images comments.
At first this script tries to read coment directly from image file. If no comment is found it ties to open comment file associated with image file. This file has the same name as image file but txt extension
For example image.txt is a comment file to image.bmp file.
+
iso boolean switch Create pictures.iso  ISO image with converted images. mkisofs.exe and dos2unix.exe are required to do this task. Images are located in images subfolder and thumbnails are located in thumbs subfolder. Image file is created in destination directory. -
folder named parameter Add specified folder and all its subfolders to ISO image. This folder is assumed as root directory in ISO image. This option only makes sense if iso switch is on. No folder to add.
jsgal boolean switch Create  gallery.xml file to jsgal script (simple web gallery). By default this file isn't created. If you use this option thumb switch must be on. It is a good idea to use iso and folder options also. gallery.xml template file must be located in the same directory where im_logo.wsf is located. -
pcdb boolean switch Create Photos.script.txt file to PhotoCDBrowser. It is a good idea to use  iso and folder options witch this switch. -
volume_id named parameter Volume ID of created ISO image file. Automatically created

Total Commander integration.

To use this job in Total Commander simply add new button to toolbar with the following parameters:

%L and %T are macros from Total Commander.Now select files you want to process in one pane and in second pane go to destination directory an push programmed button.

PhotoCDBrowser support.

pcdb switch creates Photos.script.txt playlist file for PhotoCDBrowser. If iso switch is on Photos.script.txt file is included in ISO image in browser subdirectory. To add PhotCDBrowser binary use folder parameter:

cscript.exe //NoLogo //Job:main im_logo.wsf /file_list:%L /dest_dir:%T /pcdb+ /iso+ /logo:"This is my picture!" /folder:"c:\PhotoCDBrowser"

where c:\PhotoCDBrowser folder has following structure:

+
|   AUTORUN.INF
|   runme.js
|  
+---browser
|   |   Arial.ttf
|   |   PhotoCDBrowser.bmp
|   |   PhotoCDBrowser.exe
|   |   PhotoCDBrowser.ini
|   |   ReadMe.htm
|   |  
|   +---help
|   |   |   help.english.htm
|   |   |  
|   |   \---images
|   |           cursor1.gif
|   |           cursor2.gif
|   |           cursor3.gif
|   |           cursor4.gif
|   |           cursor5.gif
|   |           cursor6.gif
|   |           e11.gif
|   |           e12.gif
|   |           e13.gif
|   |           e14.gif
|   |           e21.gif
|   |           e22.gif
|   |           e23.gif
|   |           e24.gif
|   |           e37.gif
|   |           e38.gif
|   |           e45.gif
|   |           e46.gif
|   |           file1.gif
|   |           icon1.gif
|   |           list_small.gif
|   |           list_total.gif
|   |           menu_cd.gif
|   |           menu_nav.gif
|   |           node2.gif
|   |           node3.gif
|   |          
|   +---keys
|   |       Default.keys.txt
|   |      
|   \---lang
|           English.lang.txt
|           Polish.lang.txt
|          
\---images
        PhotoCDBrowser.txt
       

Most of these files comes from PhotoCDBrowser package. I've created polish translation and Autorun.inf and runme.js scripts for auto running.

Autorun.inf file content:

[autorun]
icon=browser\PhotoCDBrowser.exe,4
open=browser\PhotoCDBrowser.exe

runme.js file content:

WshShell = WScript.CreateObject( "WScript.Shell" );
WshShell.Run( "browser\\PhotoCDBrowser.exe" );

PhotoCDBrowser.ini configuration file must be changed. Some useful options:

PathHorizon=..\images

SlideShowAutoExec=1   ;(0-none, 1-run total slideshow, 2-run small slideshow)
SlideShowAutoExecScript=Photos.script.txt

PhotoCDBrowser.txt file content:

<SLIDESHOW>%SLIDESHOW_CURRENT%/%SLIDESHOW_COUNT%</SLIDESHOW>

See PhotoCDBrowser documentation form more info.

Newer use /png+ switch because PhotoCDBrowser doesn't support PNG image format.

/thumb+ switch is useless in PhotoCDBrowser integration.

Image files comments are placed in text files and included in ISO file so PhotoCDBrowser can display them.

jsgal support.

jsgal switch creates gallery.xml file to jsgal simple web browser. If iso switch is on gallery.xml file is included in ISO image in root directory. To create gallery.xml file in destination directory template files gallery.xml and galleries.xml must be located in the same directory where im_logo.wsf script is located. These template files are included in my package  gallery.xml file is a playlist file without <image> entries. You can edit this file to change title of your gallery.When jsgal switch is on thumb switch must be on also.  To add core jsgal scripts use folder parameter:

cscript.exe //NoLogo //Job:main im_logo.wsf /file_list:%L /dest_dir:%T /thumb+ /png+ /logo:"This is my picture!" /jsgal+ /iso+ /folder:"c:\jsgal"

Where c:\jsgal folder has following structure:

+
|   AUTORUN.INF
|   babyblue.css
|   default.css
|   index.html
|   jsgal.css
|   jsgal.dtd
|   jsgal.js
|   jsgals.dtd
|   README
|   ShellExecute.js
|   simplegrey.css
|   slickgreen.css
|  
+---images
|       imgcd.ico
|      
\---thumbs

Most of these fles comes from jsgal package. I've created Autorun.inf and ShellExecute.js scripts for autorunning.

Autorun.inf file content:

[autorun]
icon=images\imgcd.ico
open=Wscript ShellExecute.js //B //nologo

ShellExecute.js file content:

WshShell = WScript.CreateObject( "WScript.Shell" );
WshShell.Run( "index.html", 3 );
WScript.DisconnectObject( WshShell );

index.html file should be modified a bit.

See jsgal documentation fo more info.
Image comments are placed in generated gallery.xml file.


img2pdf job

To put specified files to PDF file run im_logo.wsf script from command line:

cscript.exe //NoLogo //Job:img2pdf im_logo.wsf ...

Options.

Option
Type
Description
file_list
named parameter
Path to text file. Each line of this file describes full path to image file.
Total Commander automatically creates this file for you (%L macro).

unnamed parameter
Path to image file to process. May be specified many times. No wildcards may be used.
pdf_file
named parameter
Full path do destination PDF file. This option must be used.
encrypt boolean switch Encrypt generated PDF file.
Encryption password is generated by APG for Windows tool. This password is stored in text file with the same name as PDF file but with txt extension. On by default.
pwd_file boolean switch Create text file with PDF owner password (encryption password).
This password is stored in text file with the same name as PDF file but with txt extension. On by default.
printing boolean switch Allow top quality printing of created PDF file. Off by default.
PDF document must be encrypted to apply this permission.
degraded_printing boolean switch Allow lower quality printing of created PDF file. Off by default.
PDF document must be encrypted to apply this permission.
title named parameter Specify PDF title.
subject named parameter Specify PDF subject.
author named parameter Specify PDF author.
keywords named parameter Specify PDF keywords.

Total Commander integration.

To use this job in Total Commander simply add new button to toolbar with the following parameters:

%L and %T are macros from Total Commander.
Now select files you want to process in one pane and in second pane go to destination directory an push programmed button. pictures.pdf file should be created in destination directory.

Examples.

Put img1.jpg and img2.jpg files into pictures.pdf file:

cscript.exe //NoLogo /Job:img2pdf im_logo.wsf img1.jpg img2.jpg /pdf_file:pictures.pdf

Put img1.jpg and img2.jpg files into pict_noprint.pdf and disallow printing created PDF file, set My title text as title of created PDF file:

cscript.exe //NoLogo /Job:img2pdf im_logo.wsf img1.jpg img2.jpg /pdf_file:pictures.pdf /encrypt+ /title:"My title"


Requirements.

contact: roed@poczta.onet.pl