Step by Step..,it needs Time to understand all these Tools,but its fun to play with it and bijing creativ. Thankx @ RealWorldGraphics. (And sorry my bad english).
RealWorld Photos features a flexible batch image processing subsystem capable of performing multi-step operations with images. This guide shows you how to configure a scripted operation to prepare images for web. RealWorld Photos can export and import batch operations - if your goal is just to get things done, download the operation in the next paragraph and import it into RW Photos. If you want to learn how to prepare custom operations, read also the rest of the guide.
This section explains how to prepare the batch operation downloaded above step by step. To understand this section, a basic knowledge about the JavaScript language is needed.
This dialog shows the configuration of your new batch operation. You may change the name, icon and description of the operation. Name and description can be specified in multi-language format.
Note that the Operation box below is set to Sequence. The Sequence operation allows you to run multiple operations one after the other. Initially, there are 2 steps, but we will add one more later. You can use toolbar buttons above the list of steps to add new steps or reorder them.
if (Document.EXIF.Exists)
{
var orientation = Document.EXIF.GetValueByName("Orientation");
var angle = 0;
if (orientation == 'bottom - right')
angle = 180;
else if (orientation == 'right - top')
angle = 90;
else if (orientation == 'left - bottom')
angle = 270;
if (angle != 0)
{
var rotation = Operation.Create("Raster Image - Rotate");
rotation.Angle = angle;
rotation.Resize = true;
Operation.Execute(rotation, Document);
}
}
var frameX = Configuration.GetValue("frameX");
var frameY = Configuration.GetValue("frameY");
var sizeX = Document.RasterImage.sizeX;
var sizeY = Document.RasterImage.sizeY;
if (sizeX*frameY > sizeY*frameX)
{
sizeY = sizeY*frameX/sizeX;
sizeX = frameX;
}
else
{
sizeX = sizeX*frameY/sizeY;
sizeY = frameY;
}
var resampling = Operation.Create("Raster Image - Resample");
resampling.Mode = 1;
resampling.SizeXAbs = sizeX;
resampling.SizeYAbs = sizeY;
resampling.Method = 1;
Operation.Execute(resampling, Document);
The code above first checks if EXIF block is available and if that is the case, it reads the Orientation tag and translates its value to angle in degrees and finally uses the Rotate operation to rotate the image.
The second part of the JavaScript does the resizing. It reads the size of the frame (obtained from user), computes target image dimensions and resizes the image.
Now, look closely at the line Configuration.GetValue("frameX"). This line reads the value of the frameX parameter as specified by the user at runtime. Before this can be done, the parameter frameX must be declared to be a field controlled by the user.
Configuration.AddEditBox(
"frameX",
"Frame width",
"Maximum width of the resized image",
Configuration.GetValueOrDefault("frameX", 800));
Configuration.AddEditBox(
"frameY",
"Frame height",
"Maximum width of the resized image",
Configuration.GetValueOrDefault("frameY", 600));
The above code adds two edit boxes to the configuration dialog and sets their labels, help texts and default value. By using the GetValueOrDefault function, the last used values typed by a user can be preserved.
In this step the file format for saving is specified. You can also set the preferred level of compression.
The third step in the Sequence saves the resulting image to a temporary folder from where you can later move it elsewhere. It is possible to modify the configuration of this step to save the image elsewhere or even overwrite the original file, but make sure you have your data backed up. Files will be overwritten without warning.
Step by Step..,it needs Time to understand all these Tools,but its fun to play with it and bijing creativ. Thankx @ RealWorldGraphics. (And sorry my bad english).
how do you rotate the selected image?