Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Converts from a (scanned film) negative image to a positive image. |
last modified: December 11, 2023
USAGE: neg2pos [-p position] [-C color] [-o offset] [-m method] [-r refinefuzz]
-p .... position ........ position to extract perforation region background PURPOSE: To convert from a (scanned film) negative image to a positive image. DESCRIPTION: NEG2POS converts from a (scanned film) negative image to a positive image when the negative contains the exterior perforation region. Options include: stretching the image channels' dynamic range with without clipping, connected components processing to remove small regions before trimming or cropping and color balancing via white balance, gray balance or automatic. ARGUMENTS: -p position ... POSITION for extracting the perforation region background color. The choices are: northwest, northeast, southwest, southeast, corners, or an x,y coordinate. The default=northwest. The choice of corners gets the color at each corner and takes the average of the four. -o offset ... OFFSET from the directional positions. Ignored for the case when the position is a coordinate pair. Values are a comma separated non-negative x,y pair of integers. The default="1,1". -C color ... COLOR of the perforations region. Any valid IM opaque color may be use. The default is to use the -p position and -o offset to get the color. If color is specified, the -p and -o arguments will be ignored. -m method ... METHOD to use to refine the perforation region background color and to get the crop bounds of the interior image. The choices are: floodfill (f), threshold (t) or none (n). The default=floodfill. Note that method=threshold needs my script innercrop. Also if color is specified, then refining will be disabled for -m floodfill, since there is no coordinate to seed the floodfill. It will work for -m threshold. -r refinefuzz ... REFINEFUZZ is the fuzz value for refining the perforation region background color. Values are 0<=float<=100. The default=5. The refinefuzz value is often much smaller for method=threshold than for method=floodfill -t trimfuzz ... TRIMFUZZ is the fuzz value for the trimming of the image region with or without final cropping. The choices are a numerical value in the range 0<=float<=100 or "none". The default=10. -a area ... AREA is the connected components area threshold when the method=threshold. Values are integers>=0. The default=10000. -s stretch ... STRETCH the image channels' dynamic range. The options are: none (n), together (t) or separate (s). The default=separate. -l cliplow ... CLIPLOW is the cumulative percent at the low end of the histogram whose graylevel will be autostretched to full black. Values are floats between 0 and 100. If cliplow=0, then the autostretch will locate the minimum value in the channel histogram. The default=1. -h cliphigh ... CLIPHIGH is the cumulative percent at the high end of the histogram whose graylevel will be autostretched to full white. Values are floats between 0 and 100. If cliplow=0, then the autostretch will locate the maximum value in the channel histogram. The default=1. -c crop ... CROP the central image, if possible depending upon whether color is specified and the refining method used. Choices are yes or no. The default=yes. -cb colorbalance ... COLORBALANCE mode. The choices are none, gray, white, both, or auto. The default=auto. Both will be an equal blend of gray and white. Auto will try to choose the better of gray or white depending upon which one's percent selected pixels' rmse value is the smallest. -P percent ... PERCENT is the percent threshold for detecting gray/white in the image for auto color balance. Values are 0<floats<100. The default=10. -S showmask ... SHOWMASK presents the mask image that delineates the perforation region from the interior image. The choices are: view (v), save (s) or none (n). The default=none. If the value is save, then the mask will be the input file name with "_mask.gif" appended. REQUIREMENTS: Note that method=threshold needs my script innercrop. REFERENCES AND TUTORIALS: http://www.instructables.com/id/How-to-Convert-Digitized-Film-Negatives-into-Quali/?ALLSTEPS http://www.computer-darkroom.com/tutorials/tutorial_6_1.htm http://photo.stackexchange.com/questions/23942/does-a-filter-exist-to-color-correct-color-negatives-when-copying-them-with-a-ds https://www.youtube.com/watch?v=B2gLT0SWzpQ http://petapixel.com/2012/05/18/how-to-scan-film-negatives-with-a-dslr/ https://www.youtube.com/watch?v=iMO50AlGyrw CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Example 1 - Method: Floodfill |
Original |
![]() |
Arguments: |
![]() |
![]() |
Example 2 - Method: Threshold |
Original |
![]() |
Arguments: |
![]() |
![]() |
Example 3 |
Original |
![]() |
Arguments: |
![]() |
![]() |
Example 4 |
Original |
![]() |
Arguments: |
![]() |
![]() |
Example 5 |
Original |
![]() |
Arguments: |
![]() |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
What the script does is as follows for the case of method=floodfill
|