Author Topic: negfix8 exposure issue  (Read 4193 times)

MrclSchprs

  • 120
  • **
  • Posts: 71
negfix8 exposure issue
« on: June 03, 2018, 11:29:18 AM »
Hello,
   
I used to use negfix https://sites.google.com/site/negfix to convert my C41 negatives to color images. In 2013 I converted 50+ rolls with great succes.

Today I wanted to do another roll and it failed horrorably. I checked my settings and double checked my settings. Made sure that no frame borders where included. All without succes.  All images came out overexposed. My negs are correctly exposed, that I know for sure.

So I decided to download the negfix8's test file (https://sites.google.com/site/negfix/downloads/test.tif} and see what it would look like if I used the same command as given by the author of negfix8. Again overexposed.
   
So it seems to me that there is something wrong with ImageMagick/negfix8 combo. I've installed ImageMagick 6.9.9-40 Q16 x86_64 2018-04-26.
   
Anyone ever dealt with this issue?
   
Marcel

Pete_R

  • Self-Coat
  • *****
  • Posts: 2,167
    • Contax 139 Resource
Re: negfix8 exposure issue
« Reply #1 on: June 03, 2018, 01:56:32 PM »
Wow! Never even heard of negfix before or ImageMagick but both look like they deserve some investigation. ImageMagick certainly looks like it has a lot of potential.

As for your problem. There's a Gamma setting in the negfix script and there's a comment that says you might want to "fine-tune" it. It's set for 2.15 which seems high and could make the image look over exposed. Maybe try reducing it to see if it helps?

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #2 on: June 03, 2018, 08:56:30 PM »
ImageMagick certainly looks like it has a lot of potential.
Imagemagick is THE best scriptable image manipulation program. While it usually can take a bit of trial and error to get it to do what you want, once you get things right, it works wonders. I use it in conjunction with a batch script to print some contact sheets. Since I scan everything I shoot, especially 35mm since it's so fast with the crappy instant scanner I have, it quickly turns out a lot cheaper than doing silver gelatin contact prints.
If you want my script, I can put it here.

And if you want to dive in the deep waters of device profiling, check out Argyll CMS (http://www.argyllcms.com/)
« Last Edit: June 03, 2018, 09:05:19 PM by Francois »
Francois

Film is the vinyl record of photography.

MrclSchprs

  • 120
  • **
  • Posts: 71
Re: negfix8 exposure issue
« Reply #3 on: June 04, 2018, 06:19:32 AM »
It is a compatibility issue with the newer versions of ImageMagick. I've got it working now with an older version of ImageMagick. The negfix8 script is not maintained anymore by its author. Too bad ... or perhaps I should say I have got something on my hands in case of a cold and rainy day and I do not want to be in the darkroom. Thanks for the help!

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #4 on: June 04, 2018, 02:37:35 PM »
Imagemagick doesn't change their format a lot, it shouldn't be very hard to fix it.
I know they have a very helpful community that has helped me more than once.
Francois

Film is the vinyl record of photography.

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #5 on: June 04, 2018, 08:52:11 PM »
Ok Marcel!
Your problem had me really puzzled, so I investigated.
It turns out that the commands used in Negfix8 have been removed from the basic install of Imagemagick 7.
When you install it, there is an option to add legacy applications. When you check this the old Negfix8 script works like it used to.

I'm thinking of upgrading this thing a bit to make more up to date...
I looked through it and there are a few functions that are not relevant anymore.
It might also benefit from a few new things like drag & drop and a menu... though I'm not sure.

Do you think it would be a good thing?
« Last Edit: June 04, 2018, 10:43:32 PM by Francois »
Francois

Film is the vinyl record of photography.

MrclSchprs

  • 120
  • **
  • Posts: 71
Re: negfix8 exposure issue
« Reply #6 on: June 05, 2018, 06:28:55 AM »
Hmmm, that's strange. Are you sure about the version numbers?

The preferred way to install ImageMagick on a mac is by using MacPorts and the lastest version I have on an aging Mac (Mac OS X 10.7 Lion) is 6.9.9. Version 6.9.9 is given me problems. Version 6.9.7 works fine.

I was also considering to update the negfix script. Last year, or perhaps the year before last year, I thought it would be fun to master the Qt framework by starting a C++ hobby project. Besides some initial reading I never started such a project. Perhaps this is a good opportunity to do so. Haven't made up my mind yet.

When I first started using the negfix8 script I wrote a wrapper to proces a complete folder, create a custom profile for that folder, convert all raw tiff files and added some additional exif tags as well. So the suggested drag & drop feature sounds appealing.


Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #7 on: June 05, 2018, 03:14:15 PM »
I'm using the windows version and it's just a clever batch script. So it's pretty easy to modify.

I did notice that it does some checks that aren't needed anymore. Also, the original script calls the convert command whick has been replaced by the magick command.
Have you tried running the windows version under winebottler?
Francois

Film is the vinyl record of photography.

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #8 on: June 05, 2018, 06:00:48 PM »
I just looked at the Mac version and it's just a BASH script. So I modified it (hoping for the best since I can't test it)
If you set it to mode 755 (it says on the internet) and run it, it should now work.
Code: [Select]
#!/bin/bash
# negfix8 ver 1.3
# GNU General Public License v2
# (C) 2011-2013 JaZ99 - http://www.flickr.com/photos/jaz99/

# This little script converts negative (scanned as 16-bit _linear_
# positive, i.e. gamma=1.0), either C-41 color negative or B&W negative, 
# into the posivite image. Output image might require some
# minor tweaking (gamma, contrast, exposition, etc.).
# Reguires ImageMagick Q16 version (http://www.imagemagick.org/).

# Newest version is always available here:
#         [url]https://sites.google.com/site/negfix/[/url]

# IMPORTANT: For best result, scanned image MUST NOT contain holder fragments!

# You may wish to fine-tune the default settings:
COMMENT="Processed with negfix8"
GAMMA=2.15
PROF_DIR=$HOME/.negfix8
MEM="-quiet -limit memory 512M" # max physical memory used
ZIP="-compress zip"
CS=""
BINNING=""
PROF_NAME=""
SEPARATE=""
MIRROR=""
MAGICK_TEMPORARY_PATH="/var/tmp" # ImageMagick's temporary directory

# Uncomment below, if you want 20% saturation boost
#SATURATION="-modulate 100,120"


# Additional speeding up is possible:
# comment out the SAFE variable.
# It is the safeguard against divide by zero error.
# If you do scan properly, it is not needed at all.
SAFE="-evaluate Add 1"

# End of fine-tune section

if [ ! -d "$MAGICK_TEMPORARY_PATH" ]; then
    MAGICK_TEMPORARY_PATH=/tmp
fi
export MAGICK_TEMPORARY_PATH

if [ $# -eq 0 ]; then
    # ugly hack to avoid using the function...
    set -- `/bin/echo "-h"`
fi

CSPACE="-set colorspace RGB"
MAKE_PROF=1
PROF_NAME="-"

while [ $# -gt 0 ]; do
    case $1 in
-m) MIRROR="-flop"; shift;;
-s) SEPARATE="-channel $2 -separate"; shift; shift;;
-cs) CS="-contrast-stretch 0"; shift;;
-r) BINNING=$2; shift; shift;;
-g)     GAMMA=$2; shift; shift;;
-c)     PROF_NAME="$2"
shift; shift;;
-u)     MAKE_PROF=0
                PROF_NAME="$2";
if [ ! -r "$PROF_DIR"/"$PROF_NAME" ]; then
    echo "The profile $PROF_DIR/$PROF_NAME does not exist!"
    exit 98
fi
shift; shift;;
-h|-?) cat << EOF
Usage: negfix8 [-m] [-g G] [-cs] [-r {2|3|4}] [-u frame_prof] [-s {R|G|B}] input_file [output_file]
       negfix8 [-m] [-g G] [-cs] [-r {2|3|4}] [-u frame_prof] [-s {R|G|B}] input_file [input_file...]
       negfix8 -c frame_prof input_file [input_file...]

where: -g    - set image gamma to specified value (default: $GAMMA)
       -cs   - perform contrast stretch operation
       -r    - perform X-fold image size reduction, with binning*
       -c    - create frame profile from input file or files, then exit
       -u    - use created frame profile
       -s    - separate given channel to make B&W image
       -m    - mirror image horizontally

* Binning: http://www.imagemagick.org/Usage/photos/binning/sample3.html

Examples:
negfix8 -c test_profile scan001.tif
negfix8 -u test_profile -cs -r 3 -m scan002.tif scan002.jpg
negfix8 -cs scan003.tif
negfig8 -s G scan004.tif
negfix8 -c Portra400 roll123/*.tif
negfix8 -u Portra400 -cs roll123/*.tif

EOF
exit 0;;
*)      break;;
    esac
done

if [ $# -eq 2 -a ! -e "${2}" ]; then
    WORKLIST[0]="$1"
    OUTF="$2"
else
    WORKLIST=("$@")
    OUTF=""
fi

if [ $MAKE_PROF -eq 1 ]; then
    mkdir -p "$PROF_DIR"
    VALUES=(1 1 1 0 0 0)
    for i in "${WORKLIST[@]}"; do
        if [ ! -f "$i" -o ! -r "$i" ]; then
            echo "Cannot open: $i"
    exit 95
        fi
echo "Reading "`basename "$i"`
VALUES=(`magick $MEM "${i}[0]" +profile "icc,icm" $CSPACE \
        -shave 10x10 -blur 3x3 -format "%[fx: min(minima.r?minima.r:${VALUES[0]},${VALUES[0]})] \
%[fx: min(minima.g?minima.g:${VALUES[1]},${VALUES[1]})] \
%[fx: min(minima.b?minima.b:${VALUES[2]},${VALUES[2]})] \
%[fx: max(maxima.r<1?maxima.r:${VALUES[3]},${VALUES[3]})] \
%[fx: max(maxima.g<1?maxima.g:${VALUES[4]},${VALUES[4]})] \
%[fx: max(maxima.b<1?maxima.b:${VALUES[5]},${VALUES[5]})]" info:`)
    done
    if [ "${VALUES[3]}" == "0" ]; then
        echo "Cannot create the average frame profile"
        exit 97
    fi
    PROF=`magick xc: -format "${VALUES[0]} ${VALUES[1]} ${VALUES[2]} \
    %[fx: ((${VALUES[0]}/${VALUES[3]})^(1/$GAMMA))*QuantumRange*0.95] \
    %[fx: log(${VALUES[4]}/${VALUES[1]})/log(${VALUES[3]}/${VALUES[0]})] \
    %[fx: log(${VALUES[5]}/${VALUES[2]})/log(${VALUES[3]}/${VALUES[0]})]" info:`
    echo "Profile $PROF_NAME: $PROF"
    if [ "$PROF_NAME" != "-" ]; then
        echo "$PROF $GAMMA" > "$PROF_DIR"/"$PROF_NAME"
        EX=$?
        if [ $EX -ne 0 ]; then
            echo "Error saving profile, error $EX"
        fi
        exit $EX
    fi
else
    echo "Using frame profile: $PROF_NAME"
fi

for i in "${WORKLIST[@]}"; do
    if [ ! -f "$i" -o ! -r "$i" ]; then
        echo "Cannot open: $i"
continue
    fi
   
    F2=`basename "$i"`
    F=_t_$F2
    [ -z "$OUTF" ] && OUTF=P_$F2

    # Create a copy with unknown TIF tags and color profiles stripped
    # and applied user's profiles, if any
    magick $MEM "$i[0]" +profile "icc,icm" "$F" 2> /dev/null || { echo "Not enough disk space."; exit 98; }

    if [ ! -z $BINNING ]; then
        set -- `magick $MEM "$F" -format "%[fx: $BINNING*floor(w/$BINNING)] %[fx: $BINNING*floor(h/$BINNING)] %[fx: floor(w/$BINNING)] %[fx: floor(h/$BINNING)]" info:`
        BINNING_CMD="-crop ${1}x${2}+0+0 +repage -scale ${3}x${4}"
    fi

    # Read calculated or existing profile...
    if [ -n "$PROF" -a "$PROF_NAME"=="-" ]; then
        set -- $PROF
    else
        set -- `cat "$PROF_DIR"/"$PROF_NAME"`
        GAMMA=${7:-$GAMMA}
    fi

    # Real work is done below
    if [ "$5" = "1" -a "$6" = "1" -o ! -z "$SEPARATE" ]; then
            echo -n "Writing $OUTF (B&W)... "
            magick $MEM "${F}" $CSPACE $SEPARATE $BINNING_CMD $MIRROR \
                $SAFE -fx "$1/u" -gamma $GAMMA -evaluate Subtract $4 \
                $CS -comment "$COMMENT" $ZIP $SEPARATE "$OUTF"
            EX=$?
    else
            echo -n "Writing $OUTF... "
            magick $MEM "${F}" $CSPACE $BINNING_CMD $MIRROR $SAFE \
                -channel R -fx "$1/u" \
                -channel G -fx "$2/u" -gamma $5 \
                -channel B -fx "$3/u" -gamma $6 \
                +channel -gamma $GAMMA -evaluate Subtract $4 \
                $CS $SATURATION -comment "$COMMENT" $ZIP "$OUTF"
            EX=$?
    fi

    rm -f "$F"

    if [ $EX -eq 0 ]; then
      echo "Done."
      OUTF=""
    else
      echo "Error!"
      exit $EX
    fi

done

Francois

Film is the vinyl record of photography.

Bryan

  • Self-Coat
  • *****
  • Posts: 3,380
    • Flickr
Re: negfix8 exposure issue
« Reply #9 on: June 05, 2018, 06:52:59 PM »
You know why.
Tulip Polaroid Pinhole by Bryan Chernick, on Flickr

MrclSchprs

  • 120
  • **
  • Posts: 71
Re: negfix8 exposure issue
« Reply #10 on: June 05, 2018, 08:17:18 PM »
Hi Francois!

Unfortunately, the new script does not work on my Mac. Tested the new script the the most recent version MacPorts installs on my machine (6.9.9-40_0+x11).  I have plenty (gigs and gigs) of free space on my drive and it tells me "Not enough disk space."

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #11 on: June 05, 2018, 09:15:20 PM »
 :o
Well.... that was a very short trip.............


I guess the easiest would probably to install WINE (https://wiki.winehq.org/MacOS) and use the Windows version. But that seems messy to me....
Unless I can figure out a way to stick it all in a single EXE or something like that and make it a standalone thing....


BTW Bryan, thanks for the tulips  ;D
Francois

Film is the vinyl record of photography.

Indofunk

  • Global Moderator
  • Self-Coat
  • *****
  • Posts: 3,682
    • photog & music
Re: negfix8 exposure issue
« Reply #12 on: June 06, 2018, 01:05:00 AM »

MrclSchprs

  • 120
  • **
  • Posts: 71
Re: negfix8 exposure issue
« Reply #13 on: June 06, 2018, 04:45:31 AM »
:o
Well.... that was a very short trip.............


I guess the easiest would probably to install WINE (https://wiki.winehq.org/MacOS) and use the Windows version. But that seems messy to me....
Unless I can figure out a way to stick it all in a single EXE or something like that and make it a standalone thing....


Regarding Wine .... no, that's too much of a good thing. As you said too much hassle. I'll stick with the old version of ImageMagick.

And the standalone thing. Well that was my initial idea to create a platform independent GUI application using the ImageMagick libraries instead of the IM console application. It seems a fun thing to do, but it also requires some serious commitment.

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #14 on: June 06, 2018, 03:29:23 PM »
Yeah, and wrapping everything in a single exe, while it's fairly easy to do, it almost always makes antivirus software produce false positives at some point... So I guess you better stick to the simple solution.


BTW guys, I'm really proud of those nice flowers. I haven't had the chance to get a flower foul in quite some time  ;D
Francois

Film is the vinyl record of photography.

Bryan

  • Self-Coat
  • *****
  • Posts: 3,380
    • Flickr
Re: negfix8 exposure issue
« Reply #15 on: June 06, 2018, 04:30:37 PM »
BTW guys, I'm really proud of those nice flowers. I haven't had the chance to get a flower foul in quite some time  ;D

Francoise, I could be wrong but I think you may hold the distinction of the Most Flowered Filmwaster.

Francois

  • Self-Coat
  • *****
  • Posts: 15,889
Re: negfix8 exposure issue
« Reply #16 on: June 06, 2018, 09:15:43 PM »
You're probably right about this one :)
I might not be good at much stuff but I probably excel at getting those technical flower fouls  ;D
Francois

Film is the vinyl record of photography.