Support my work on Patreon

If you like my work, please consider to help my growing family with a little financial support through my Patreon creator page.


Alternatively, you can leave a one-time donation via PayPal using the Donate button below.

Total Pageviews

Tuesday, January 27, 2015

Basic batch processing with PhotoFlow

The development branch of PhotoFlow now provides a new command that allows some basic batch processing. The batch processor is called pfbatch and gets installed in the same directory as the interactive photoflow command.

The general syntax of the pfbatch command is the following:

    pfbatch input_file [preset_1]...[preset_n] output_file

and can be used to perform different kind of tasks:
  • export an existing PFI file to TIFF or JPeg, optionally applying additional presets (I'll come back to that later in this post)
  • load a TIFF or JPeg file and save it as PFI file
  • load a TIFF or JPeg file, apply some presets and export again as  TIFF or JPeg
  • load a PFI file,  append some presets and save again as PFI

To make a concrete example, let's assume you have a certain number of edited images (saved as PFI files), and you want to create down-scaled versions to be posted on the web. You probably also want the web images to be converted to sRGB, just to make sure that they will display at least decently even on browsers that ignore ICC profiles.

The downscaling and sRGB conversions are additional operations that are not contained in the input PFI files, and that have to be applied to each image we are converting. All we need to do is to create a couple of presets for that, and then append them to the input file when calling pfbatch.

In order to create the presets, you first need to open an existing image with photoflow, and then add any layer that you want to save as a preset.

The example below shows how to add a "Scale & rotate" layer to an existing image: we will use this tool to create a preset that scales the image to a size of 800x600 pixels at most (the "Scale & rotate" tool is found under the "geom" tab of the "new layer" dialog).



Now we have to adjust the parameters of the scale tool so that the final image will fit into 800x600 pixels. The scale tool in PhotoFlow works similar to the "-resize" command in ImageMagick: when scaling the image, the tool will preserve its aspect ratio and will make sure that the resulting image fits into the given size. Therefore, we simply need to specify the desired size (in pixels) in the correspoding tool dialog:



At this point, with the "resize" layer still selected, click on the "Save" button below the layers list to save it as a preset (with extension ".pfp"):



In the following I will assume that you have saved this preset as "$HOME/presets/web_resize.pfp".

Now you have to do the same for the sRGB conversion: add one more layer of type "Color profile conversion" (you will find it in the "conv" tab of the "new layer" dialog) and leave the parameters to their defaults. In my case, the layer is simply named "sRGB":



Make sure that only the "sRGB" layer is selected, then click on the "Save" button below the layers list to save it as an additional preset (I'll assume you have called it "$HOME/presets/sRGB.pfp").

You can also save several layers in one single preset, either by selecting them before clicking on the "Save" button, or by inserting them into a group layer and saving the group itself as a preset.

At this point, everything is ready to batch-convert your first image for the web (of course you need to replace the input and output file names with your actual files):

    pfbatch input.pfi $HOME/presets/web_resize.pfp $HOME/presets/sRGB.pfp output_4web.jpg

This command can also be used inside a Makefile. Here is how a generic rule could look like:

    Web/%.jpg: %.pfi
        pfbatch $< $HOME/presets/web_resize.pfp $HOME/presets/sRGB.pfp $@

 This will run through all the *.pfi files in the current directory and save the resulting resized JPeg files in the "Web" subdirectory.

For the future I am planning to make the batch processing tool more intuitive and user-friendly, and add some GUI interface to it. However, the pfbatch commmand will most likely remain there as the basic building block for everything else...

Monday, January 12, 2015

Experimental LensFun support added into PhotoFlow

An initial implementation of LensFun support has been added into PhotoFlow.

The tool is still experimental, and limited in functionality:
  • the camera and lens information can only be extracted from the EXIF metadata, and not specified by hand
  • only distorsion and TCA corrections are implemented for the moment, the vignetting is still missing
  • there is no possibility yet to select the corrections to be applied
  • the interpolation is performed using a simple nearest neighbour method, to be replaced with a better interpolator in future


Nevertheless, if you are interested in this feature and you want to help me in the testing and debugging process, the tool can be accessed from the "Geometry" tab of the tool selector. The tool is called "Optical corrections":


Here is how the tool dialog looks like:


The LensFun tool is for the moment only available from the GitHub sources.
Two additional dependencies are needed to compile PhotoFlow: exiv2 and LensFun.

As any other experimental code, it still contains bugs and is likely to produce frequent crashes, therefore I recommend to frequently save your work while testing it.

Monday, January 5, 2015

Photoflow update: crop tool, foreground extraction and layer shifting

Interactive crop tool

PhotoFlow has finally some decent crop tool. It is now possible to define the crop area interactively with the mouse, or directly by the numbers. The cropped area can be resized by dragging the right or bottom edges, or the bottom-right corner. It can also be moved by dragging anywhere inside the area itself.

An example of the crop tool in action is shown below.



Foreground extraction tool (G'MIC)

The foreground extraction tool now works as a "mask generator": the output of the tool is a black & white image that represents the foreground mask, and that can be used as a layer mask for better flexibility.
The foreground points (green ones) are added with the left mouse click, while the background points (red ones) are added with the right click. To remove some point, one has to click on it with the middle mouse button.

I'm preparing a detailed step-by-step tutorial on the subject, to show how the foreground mask can be used and further edited.

Below one can see the tool in action (top screenshot is the original image with the control points, bottom screenshot is the generated mask).




Blending images of different size and layer shifting

It is now possible to blend images with different sizes, as well as shift one image with respect to another one. Two additional controls have appeared in the layer configuration dialogs, allowing to define the horizontal and vertical layer shifts. Any opacity mask associated with the shifted layer also gets shifted automatically.

Below one can see the rose blended on top of another image, using the foreground extraction mask in the blending process.