Author Topic: The Contraption 21: Index print maker  (Read 1364 times)

0 Members and 1 Guest are viewing this topic.

Francois

  • Self-Coat
  • *****
  • Posts: 12,348
The Contraption 21: Index print maker
« on: May 23, 2015, 03:52:23 PM »
I know this is not film related per say, but I think it's a nice thing to have on hand.
I don't know if you're anything like me but I just love those small 4x6 index prints I get from the photofinisher. They're a handy way to keep track of the pictures on a roll and take very little place. But one of the problems is that if you do your own film developing and scanning, you don't get them.
I did try a few other programs to do index prints but they're all too complicated to use. I just wanted something that's a no brainer. Drop a folder on the program and pop it saves an index print in the folder you just dropped. Sounds simple but it's not really.

Since I wanted performance, I decided to stick with Imagemagick (imagemagick.org) as it's a very fast command line processing that doesn't require a lot of coding from scratch. Little did I know it would give me such a hassle! I've been slaving over this for 4 days now and the thought of modifying it more just makes me sick to my stomach... this thing is a pain until you finally figure out that you have to count pixels until your brain hurts.

So, here are my results. Just copy the script and save it in a text file named ContactPrint.cmd on your desktop.
Quote
@echo off
rem Make Contact sheet script
rem by Fran├žois Laverdure

rem To use, simply copy to a folder that has a path to it
rem and call from the desired folder. It will generate
rem a contact sheet from this folder's content.
rem it supports JPG

echo Contact Print Creator for JPG files
echo.
echo Please wait for index print to be created.
rem Go to drag and drop folder
cd "%~1"

rem Get current dir name
for %%* in (.) do set CurrDirName=%%~n*

rem Count number of files in folder
for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A

rem check if less than
if %cnt% lss 20 goto Mini
rem check if less or equal
if %cnt% leq 30 goto Normal
rem check if greater than
if %cnt% gtr 30 goto Big

:Mini
montage -units PixelsPerInch -density 300 ^
-tile 5x4 -label %%f -font Arial -pointsize 6 -background "white" ^
-fill "black" -define jpeg:size=356x228 -geometry 356x228+2+2 ^
-auto-orient *.JPG -title %CurrDirName% contact.jpg
convert contact.jpg -gravity north -background white -extent 1800x1200 contact.jpg
goto end

:Normal
montage -units PixelsPerInch -density 300 ^
-tile 6x5 -label %%f -font Arial -pointsize 6 -background "white" ^
-fill "black" -define jpeg:size=296x186 -geometry 296x186+2+2 ^
-auto-orient *.JPG -title %CurrDirName% contact.jpg
convert contact.jpg -gravity north -background white -extent 1800x1200 contact.jpg
goto end

:Big
montage -units PixelsPerInch -density 300 ^
-tile 7x6 -label %%f -font Arial -pointsize 6 -background "white" ^
-fill "black" -define jpeg:size=253x154 -geometry 253x154+2+2 ^
-auto-orient *.JPG -title %CurrDirName% contact.jpg
convert contact.jpg -gravity north -background white -extent 1800x1200 contact.jpg
goto end

:End
echo print created

Here's what the index files it creates look like.
I'll write more on it when my head stops hurting  :(
« Last Edit: May 23, 2015, 03:55:08 PM by Francois »
Francois

Film is the vinyl record of photography.

Francois

  • Self-Coat
  • *****
  • Posts: 12,348
Re: The Contraption 21: Index print maker
« Reply #1 on: May 23, 2015, 09:25:03 PM »
OK, better now.
This program only works on JPG files for now and also doesn't support long file names with spaces in them. I'll have to figure this one out.

But I don't mind since all my pictures are in folders named using the ISO date format (yyyy-mm-dd).

The program starts by getting the name of the folder that was dropped. Then it switches to that folder and counts the number of files in it. It's not very smart about this but since I rarely have many files other than images in my folders, it doesn't matter much. It uses the number of files to calculate the number of frames to put in the index card. Then comes the nightmare part of the script.

It calls the montage command of Imagemagick to do a mosaic of either 7x6, 6x5 or 5x4 images for a total of 42, 30 or 20 images. The images are sized differently depending on the number of images in the index. On top of the mosaic is the folder name that is centered and each file name is printed under each frame.

Because of fractional errors, the final print is not always a 4x6 print in landscape mode, so I call the convert command to make the canvas of the final image an exact 4x6 print.

Then the program simply exits.

If anybody has experience with Imagemagick and wants to propose an improvement, please feel free to do so.
So far, my goal was to get index prints as nice as the ones that came from Kodak... it's a far cry from that but at least it's better than all the other programs I tried.

Hope you find this script useful.
Francois

Film is the vinyl record of photography.

Kayos

  • Peel Apart
  • ***
  • Posts: 383
    • My Blog
Re: The Contraption 21: Index print maker
« Reply #2 on: May 23, 2015, 10:02:41 PM »
I'm liking this

contact by Stuart Burrows, on Flickr

Need to use smaller file names, and I had to export the files as jpegs for this test (all my scans are high res tiffs) but its worked and as I become more organized will only be helpful

Ive never used the software before but I used to Bash script for fun, so I will certainly look at adding a way of doing tiffs, my initial thoughts are convert a copy, make the contact sheet and delete the copy?

Francois

  • Self-Coat
  • *****
  • Posts: 12,348
Re: The Contraption 21: Index print maker
« Reply #3 on: May 23, 2015, 11:18:34 PM »
You can tell it to directly convert tiffs by replacing the *.jpg by *.tif (or even adding *.tif after *.jpg)
The only drawback I found when using tif files is that they are slow to process and take a lot of memory to make the sheet. But apart from that, it works.

The thing with JPG files is that I have the software pre-resize them before adding them to the sheet.

As for the font, I use arial 6 points. It's fixed by the -pointsize function. You can also use a smaller font like Pixel7 (http://www.dafont.com/smallest-pixel-7.font) or 3x3 (http://www.dafont.com/3x3-font-for-nerds.font).
Francois

Film is the vinyl record of photography.

Kayos

  • Peel Apart
  • ***
  • Posts: 383
    • My Blog
Re: The Contraption 21: Index print maker
« Reply #4 on: May 24, 2015, 08:43:26 AM »
I don't mind it being a bit slow, I've got plenty of memory to play with :)

The files in that folder did have fairly long names, but if I create a contact before importing into Lightroom I can use it to look at thumbnails, even in develop mode

So if I just add *.tif after *.jpg in each function it will work?

Francois

  • Self-Coat
  • *****
  • Posts: 12,348
Re: The Contraption 21: Index print maker
« Reply #5 on: May 24, 2015, 02:48:57 PM »
Yes it will work. You'll get an error message at the end of the processing but it won't affect the output.
Francois

Film is the vinyl record of photography.

Francois

  • Self-Coat
  • *****
  • Posts: 12,348
Re: The Contraption 21: Index print maker
« Reply #6 on: May 27, 2015, 09:18:54 PM »
I just did a variation on the first version.
This one can be a bit faster for files that aren't JPG. But the files don't have the correct extensions since I create the thumbnails and then the page in two steps.
I use the mogrify function to create each thumbnail individually and save them under Imagemagick's own format. Then I create the index page from those, resize the page and delete all the working files in the folder.
Quote
@echo off
rem Make Contact sheet script
rem by Fran├žois Laverdure

rem To use, simply copy to a folder that has a path to it
rem and call from the desired folder. It will generate
rem a contact sheet from this folder's content.
rem it supports JPG and TIFF

echo Contact Print Creator
echo.
echo Please wait for index print to be created...
rem Go to drag and drop folder
cd "%~1"

rem Get current dir name
for %%* in (.) do set CurrDirName=%%~n*

rem Count number of files in folder
for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A

rem check if less than
if %cnt% lss 20 goto Mini
rem check if less or equal
if %cnt% leq 30 goto Normal
rem check if greater than
if %cnt% gtr 30 goto Big


:Mini
mogrify -format mpc -thumbnail 356x228 *.tif
mogrify -format mpc -thumbnail 356x228 *.jpg

montage -units PixelsPerInch -density 300 ^
-tile 5x4 -label %%f -font Arial -pointsize 6 -background "white" ^
-fill "black" -geometry 356x228+2+2 ^
-auto-orient *.mpc -title %CurrDirName% contact.jpg
goto end

:Normal
mogrify -format mpc -thumbnail 296x186 *.tif
mogrify -format mpc -thumbnail 296x186 *.jpg

montage -units PixelsPerInch -density 300 ^
-tile 6x5 -label %%f -font Arial -pointsize 6 -background "white" ^
-fill "black" -geometry 296x186+2+2 ^
-auto-orient *.mpc -title %CurrDirName% contact.jpg
goto end

:Big
mogrify -format mpc -thumbnail 253x154 *.tif
mogrify -format mpc -thumbnail 253x154 *.jpg

montage -units PixelsPerInch -density 300 ^
-tile 7x6 -label %%f -font Arial -pointsize 6 -background "white" ^
-fill "black" -geometry 253x154+2+2 ^
-auto-orient *.mpc -title %CurrDirName% contact.jpg
goto end

:End
convert contact.jpg -gravity north -background white -extent 1800x1200 contact.jpg
rem cleanup workspace
del *.mpc
del *.cache
echo print created

So far, I don't know which one I prefer...
Francois

Film is the vinyl record of photography.