Tuesday, March 25, 2014

Modifying LightZone sidecar files

LightZone sidecar file

My this blog is about the internals of the LightZone sidecar file and what you can do with it. As I mentioned in one of my posts in the LightZone forum that I'll create a small utility that can extract the LightZone "receipe" from the _lzn.jpg file. The only obstacle was that I needed to learn Python first.

I found from an old unofficial LightZone blog an lzntool utility made by Alex Sidorenko. The software was created for situations where you move or rename the original raw image. Quote from the original web site: "As these two files [_lzn.jpg and RAW] are interrelated, moving/renaming them can create problems. Usually moving both files to another directory is OK (we will discuss this later). But if you change the name of your raw file, LZ will see it as unrelated to LZN-file. Just renaming the associated lzn-file will not help - you need to change the contents of LZN-file as well." So if you want to move or rename the RAW file you need do the changes in the file system and then modify the contents of the LZN file to reflect the changes.

The problem is that the LZN files are binary and the LightZone block is preceded with binary length so editing the files would require a binary editor and manual calculations for the block length. For that reason Alex created his Python program to solve this problem.  Alex explains on the web page well how to identify the LigthZone block from the JPEG file.

I took his program, converted it from Python 2 to Python 3 and added an option to extract the LZN block to a new .lzn file without the JPEG preview image. This file can then be edited with Notepad or other text editors and used in LZ. This is a command line utility and you need to have Python 3 installed.

>Python lzntool020.py --help
usage: lzntool020.py [-h] [-l] [--setrawpath SETRAWPATH]
                     [--setrawrelpath SETRAWRELPATH] [--setname SETNAME] [-t]
                     [-v] [--version]
                     fname

positional arguments:
  fname                 _lzn.jpg file

optional arguments:
  -h, --help            show this help message and exit
  -l, --list            list path names as used by LZ and exit. Adding '-v'
                        will print the whole LZ-section
  --setrawpath SETRAWPATH
                        Modify RAW file pathname in LZN-file. This does not
                        rename the real RAW-file
  --setrawrelpath SETRAWRELPATH
                        Modify RAW file relpathname in LZN-file. This does not
                        rename the real RAW-file
  --setname SETNAME     Modify both path and relPath by changing name only, do
                        not modify the directory parts
  -t, --text            Extract the LZN info from the file and store it as
                        .lzn file
  -v                    verbose output
  --version             Display version information and exit.

There are some issues you need to be aware
  • if you specify --setname and --setrawpath and/or --setrawrelpath the --setname will be overwritten by the two other parameters
  • using the .lzn file in LightZone has some issues (see below)

LightZone opens the .lzn file without any problems. The problem I haven't been able to solve is how to make LZ to save the changes as .lzn. Currently LZ saves the changes with the preview image (like _lzn.jpg). This file generates an error in LZ when reopened unless the .lzn is renamed to _lzn.jpg, then LZ works fine. The error message is "Error reading the file Couldn't read XML:com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence."

I looked at the source code in github and guessed that setting <Save type="LZN"> would work. But when I try to open the file in LZ I get an error "Malformed LightZone file No valid SaveOptions data". For time being I have left the  <Save type="JPEG (sidecar)"> with the side effects.

Has the support for saving as .lzn been removed in some older version even the backwards compatibility to read the .lzn files has been kept? I hope someone having better understanding of the insides of LZ could help me.

Download

Monday, March 17, 2014

Artistic with LightZone

I played during the last weekend with LZ and tried to find ways how to create little different look to my photo.

My daughter was going to a masquerade ball, dressed in black dress, red shoes and red masque with yellow feathers. Here is the original image with the in-camera settings.

I had an external flash placed quite near on the right and a white door facing my daughter. The setting gave the strong shadow on the white wall and still the reflecting light illuminated her face.

In LZ I set
  • the WB to 6000K and decreased exposure by 1/3
  • applied standard Canon 600D raw tone curve
  • added vibrance (+30) to mids & highlights
  • softened the skin with standard style "Skin Glow" and changed the skin color to match the skin in the image
  • added color to masks and shoes with additional Saturation +20 and Vibrance +10 (2 × Hue/Saturation tool: applying to red and yellow)


This was now quite good standard portrait. But I wanted to do some more. I wanted to create an image that looked like made bt "Andy Warhol". I used Gaussian Blur on mids & highlights and highly over-did it. I set the radius to 150 to achieve the result below.


I'm happy with the final result and also that I could achieve all in LZ. The tool stack helped to experiment and revert to previous version easily and I didn't have to work with multiple tools and copies.

If you want the get really psychedelic results, use large radius and set the blend mode to difference.

Tuesday, March 4, 2014

LightZone default Tone Curve for Canon 600D

Finally I have had some time to do some more experimenting. Some posts in the LZ forum hinted that there might be some issues with the Raw Tone Curve for Canon 600D. I unlocked the Tone Curve and just experimented changing the default mode "RGB" to "Luminosity". The difference is huge and the luminosity setting produces much more natural tones. The RGB image is over saturated.
RGB Tone Curve (default) Luminosity Tone Curve
As a reference, here is again the same image in DPP. The image in DPP is warmer (more yellow), but otherwise the overall saturation of reds and yellows are quite much alike with the luminosity setting and in DPP.
Canon's DPP