Monday, June 10, 2013

More about Lightroom and sqlite

If you follow the instructions in my previous post you'll note that I was actually just renaming files, not moving them. For example, I was suggesting to rename "2012/January 03" to "2012/01_03", but you can also move the entire folder to a nested subfolder, replacing the space with '/', so replace "2012/January 03" with "2012/January/03".
However this requires an additional step:

  • the folder "January" in LR database needs to be an entity of its own: if you blindly replace "January 03" with "January/03", LR will see folder "03" correctly as part of the catalog, but not its parent "January"; so, for example, you'll see "January (500 pictures)" in LR folder tree, but clicking on "January" you won't see anything, even with "display pictures from subfolders" enabled.
  • the simplest fix for this is: copy a single jpeg file in all the folders 2013/January, 2013/February, ... 2012/January, 2012/February... 
for n in $(find . -type d -d 2 | grep "\./20"); do cp ~/Temp/test.jpg $n/; done
  • then run "Synchronize folder" from LR, deselect "don't import duplicates", import all the copies of your jpeg and trash them immediately after

Wednesday, January 23, 2013

Lightroom folder batch-rename with sqlite

Here's a quick tutorial for doing batch-renames of folders in Lighroom 4.
Warning #1: the tutorial is written for mac, but it would possibly work with minor modifications on Windows if you have the sqlite3.exe binary available, however I cannot test it.
Warning #2: don't trust blindly what I write here, the idea is absolutely correct, but I may make mistakes while I type, or omit some steps, so backup everything before you start and don't do it unless you know what you are doing.

Let' suppose my folders are of the form "2013/January 01" and I want to change them to "2013/01_01". From LR interface, you could right-click on the folder and select "Rename", but if you have thousands of them, it would take forever.

Close LR. Open a text editor, instead, and create a plaintext file (say "print.txt"), enter 12 lines like the following:

SELECT 'mv ' || QUOTE(pathFromRoot) || ' ' || QUOTE(REPLACE(pathFromRoot, 'January ', '01_')) from AgLibraryFolder WHERE pathFromRoot LIKE '%January %';

SELECT 'mv ' || QUOTE(pathFromRoot) || ' ' || QUOTE(REPLACE(pathFromRoot, 'February ', '02_')) from AgLibraryFolder WHERE pathFromRoot LIKE '%February %';

...


Windows users should probably type 'move ' instead of 'mv ' (don't forget the space).
Now create a different plaintext file (say "update.txt"), with 12 lines like this:

UPDATE "AgLibraryFolder" SET pathFromRoot = REPLACE(pathFromRoot, 'January ', '01_') WHERE pathFromRoot LIKE '%January%';

...

Open a terminal prompt and cd to the folder where the catalog lives. Let's assume that the catalog file name is LR4.lrcat.
Enter the following commands:

cat print.txt | sqlite3 LR4.lrcat > batch_rename.sh
bash batch_rename.sh
# check that everything is ok, then:
cat update.txt | sqlite3 LR4.lrcat
rm batch_rename.sh


Windows users should write something like this:


type print.txt | sqlite3 LR4.lrcat > batch_rename.bat
batch_rename.bat
# check that everything is ok, then:
type update.txt | sqlite3 LR4.lrcat
del batch_rename.bat



Sunday, October 28, 2012

Slow Lightroom down with USB


On my Lightroom wish-list, I always had an item about the CPU usage: I often run "heavy" processor-intensive tasks, and I use a laptop, which is definitely not optimized for heat dissipation.
So I don't care if the task takes 2 or 8 hours, as I'm going to run it overnight anyway... Instead, I care it does not keep the CPU at 100% all the time, because I don't want the computer to melt, and I don't want the fans to run at full speed during the night.
The typical scenario is an export task, but I seem to have found a reasonable workaround: export to a USB device.
Lightroom probably waits for an image to be successfully written before converting the next; a slow USB device seems to give the processor enough "waiting time" to avoid overheating.
I have to admit that in the long run, it tends to be less effective, but I think that connecting the USB to a network device might help even more.

Monday, October 15, 2012

Wi-Fi enabled SD cards

I have an eye-fi card, the classic X2 model (8GB, class 6). I bought it when very few people knew about it, and it roughly works as advertised.
Which means: fine, if you shoot jpeg; slowly, if you upload large images to the camera.

However the biggest problem for me is what is not advertised, namely that you need both an internet connection and a special software just to access the card settings.
If you want the card to connect to a new wi-fi network, you need to log-in into their utility software, enter network name and password, which are uploaded to a server, from which (I think) it downloads a new "mini firmware update" on the fly.
So you need to do this in advance, unless you carry with you some wi-fi hotspot (a macbook is fine: macs can create a wi-fi network), not to mention, the potential security problem: there may be a database full of network credentials somewhere...

Today, I noticed that there's an alternative technology, a card that has an http server included: clients can connect, browse thumbnails and download pictures.

http://www.toshiba-components.com/FlashAir/index.html

Monday, August 13, 2012

Lightroom local controls

An interesting discussion on the Adobe Forum suggested that we don't know enough about how local and global controls interact in Lightroom.


Here I take an image (above) and apply global saturation -100


Now I'm going to add a graduated filter with saturation -100. Obviously it does nothing to the image, as it's completely desaturated:


Less intuitive is that when local saturation is boosted to +100, the net effect is not saturation 0 (which would make the picture half colored). It seems that the global effect is applied last, and in a different stage:



Local adjustements, instead, will sum nicely (given that they do not exceed a reasonable parameter range). So here +100-100 = 0. If you overlap more adjustments, then the +100 are eventually going to overflow, so there's no guarantee that the final result will be nicely predictable:




As it was pointed out on the thread, local saturation is additive with color saturation. So we can bring all colors down to -100 and restore them locally with a graduated filter/adjustment brush:





Now the inverse experiment: graduated filter with saturation -100. 
Moving slightly global saturation from 0 to +100, you can see that the saturation affects the grey part of the image. (you would need an animation to see it, but it's really evident if you try; anyway in the grey part of the first image here, there's more white).





But the issue is even more complex.
As pointed out in this book, for example, some sliders will apply a different algorithm for different ranges of parameters (e.g. positive and negative clarity). So if the total value of the parameter is not "consolidated" between the various sliders, there's no guarantee of what the final effect will be.