{"id":18783752,"url":"https://github.com/tomkyle/negatives-positive","last_synced_at":"2025-04-13T12:13:25.085Z","repository":{"id":77717260,"uuid":"90195785","full_name":"tomkyle/negatives-positive","owner":"tomkyle","description":"Converts digital film negatives (TIFF files) to positive images, using GNU Parallel for timesaving.   Other features: Gamma correction, sigmoidal contrast enhancement, resizing, JPG conversion.","archived":false,"fork":false,"pushed_at":"2017-06-29T10:20:10.000Z","size":88,"stargazers_count":13,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T12:13:19.592Z","etag":null,"topics":["homebrew","linear","negatives","photography","tiff"],"latest_commit_sha":null,"homepage":"https://tomkyle.github.io/negatives-positive/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomkyle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-03T21:40:48.000Z","updated_at":"2025-03-28T07:06:47.000Z","dependencies_parsed_at":"2023-03-14T23:30:32.209Z","dependency_job_id":null,"html_url":"https://github.com/tomkyle/negatives-positive","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkyle%2Fnegatives-positive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkyle%2Fnegatives-positive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkyle%2Fnegatives-positive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomkyle%2Fnegatives-positive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomkyle","download_url":"https://codeload.github.com/tomkyle/negatives-positive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710447,"owners_count":21149191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["homebrew","linear","negatives","photography","tiff"],"created_at":"2024-11-07T20:40:32.677Z","updated_at":"2025-04-13T12:13:25.077Z","avatar_url":"https://github.com/tomkyle.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# negatives/positive\n\n**Convert your digital film negatives (linear TIFF files) to positive images.** Other features:\n\n- **Gamma correction** for adjusting midtones\n- **Sigmoidal contrast** for highlights and shadows adjustment\n- **Grayscaling:** B/W lovers save up to 60% disk space. \n- **Resizing**  when megapixels are not everything\n- **Zipped TIFF or JPEG conversion** \n\n**What happens inside?** [ImageMagick](https://www.imagemagick.org/script/index.php)  does the image editing. [GNU Parallel](https://www.gnu.org/software/parallel/) mangles multiple images in parallel, depending on your CPU cores.\n\n*These first releases of this package are developed and tested with B/W negatives.*\n\n\n\n## Homebrew Installation (MacOS)\n\n\nThe *positive* bash script can be installed by a [Homebrew](https://brew.sh/) formula, which itself is part of the [tomkyle/homebrew-negatives](https://github.com/tomkyle/homebrew-negatives) tap. \n\n```bash\n# Variant 1:\n# Install tap first, formula second\n$ brew tap tomkyle/negatives\n$ brew install positive\n```\n\nAs “tapping” first is not neccessarily needed, you can install the formula directly:\n\n```bash\n# Variant 2\n$ brew install tomkyle/negatives/positive\n```\n\n\n# Usage\n\nOpen your terminal application and go to your images directory. *positive* will work in the current working directory. Run `positive --help` or `-h` to display help text. \n\n\n```bash\n$ positive [options] [--all | file(s)]\n```\n\nSee [Options](#options) · [Examples](#xamples) · [Gamma correction](#gamma-correction) · [Sigmoidal contrast](#sigmoidal-contrast) · [Workflow Recommendations](#workflow-recommendations) · [**Issues and FAQ**](#issues-and-faq)\n\n## Options\n\n[Files and Output](#files-and-output) · [Color and Contrast](#color-and-contrast).\n\n### Files and output\n\n\n#### -a, --all\nAll images (batch mode). Process any TIFF file in working directory.\n\n#### --debug\nSwitch on debugging mode, showing everything that's going on.\n\n#### -f, --flipflop *direction*  \nMirror the image vertically and/or horizontally. Possible values are `flop` horizontal, `flip` vertical or even `flipflop` (guess what). Example: `-f flop`\n\n\n#### -j, --jpeg *quality*\nSave image as JPG with given quality. Example: `-j 90`\n\n\n#### -o, --output *path*  \nOutput directory — default is current working directory. Example: `-o results`\n\n\n#### -r, --resize *pixel*\nResize  image — pixel width for larger side, preserving aspect ratio. Example: `-r 3000`\n\n#### -v, --verbous\nVerbous mode — show some more information under way.\n\n\n\n### Color and Contrast\n[Files and Output](#files-and-output) · [Color and Contrast](#color-and-contrast).\n\n#### -d, --desaturate\nDesaturate colors, recommended for B/W negatives. Bonus: The TIFF will be converted to 16 bit Grayscale, saving up to 60% in file size; The image will have linear gamma 1.0 ICC profile applied (Gray-elle-V4-g10.icc).\n\n#### -g, --gamma *value*\nGamma correction value to apply. It is highly recommended to use this parameter with linear TIFF images, together with **-n**. Pass a float value like `2.4` or `auto`. *Auto* will apply a calculated gamma adjustment based on the mean values of an image. Examples: `-g 2.2` and `--gamma auto`\n\n#### -n, --normalize\nStretch histogram to reach black and white points. Recommended for most images.\n\n#### -s, --sigmoidal *value*\nSigmoidal contrast value around 50% middle-gray. Increases the contrast without saturating highlights or shadows. Quoted from ImageMagick docs: “3 is typical and 20 is a lot.” Example: `-s 5`\n\nSee [Usage](#usage) · [Examples](#xamples) · [Gamma correction](#gamma-correction) · [Sigmoidal contrast](#sigmoidal-contrast) · [**Issues and FAQ**](#issues-and-faq)\n\n\n## Examples\n\n### Single mode: Turn some TIFF files into positive.\nGiven your photographed negative is a B/W image, so we are using desaturation and grayscaling here. The result will be a grayscale TIFF with approriate ICC profile. *Please note that the positive image gets a `-positive` suffix when it is stored in the same directory like the original image.*\n\n```bash\n# These are equal:\n$ positive --desaturate DSC_0123.tif\n$ positive -d DSC_0123.tif\n```\n\n```bash\n# Output\nDSC_0123.tif\nPositive ✔ Result DSC_0123-positive.tif\n```\n\n**Second example:** Again, we use desaturation, and this time the positives go as JPG into a subdirectory. The results are now stored in a `foobar` directory (Note: no `-positive` suffix).\n\n```bash\n# These are equal:\n$ positive -d --jpg 85 --output foobar DSC_0123.tiff DSC_0124.tiff DSC_0125.tiff\n$ positive -d -j 85 -o foobar DSC_0123.tiff DSC_0124.tiff DSC_0125.tiff\n```\n\n```bash\n# Output\nDSC_0123.tiff\nPositive ✔ JPG-80 ✔ Result foobar/DSC_0123.jpg\n\nDSC_0124.tiff\nPositive ✔ JPG-80 ✔ Result foobar/DSC_0124.jpg\n\nDSC_0125.tiff\nPositive ✔ JPG-80 ✔ Result foobar/DSC_0125.jpg\n```\n\n\n### Batch mode: Convert *all* TIFF files in the current directory\n\nJust pass `--all` or `-a` option, and the script will mangle everything that has a TIFF extension: `tif, tiff, TIF, TIFF` etc.\n\nThe batch mode uses [GNU Parallel,](https://www.gnu.org/software/parallel/) so every single CPU core will be used. So if you have a Quadcore CPU, four images will be processed at the same time. Great timesaver!\n\nSince normalizing is a good idea, we use the `--normalize` or `-n` option in addition to desaturation with `-d`.\n\n```bash\n$ positive --all -d -n -o results\n$ positive -adn -o results\n```\n\n```bash\n# Output\nProcess 3 images, using GNU Parallel:\n\nDSC_0123.tiff\nPositive ✔ Result foobar/DSC_0123.tiff\n\nDSC_0124.tiff\nPositive ✔ Result foobar/DSC_0124.tiff\n\n(...and many more...)\n\nSome stats:\nCPUs used:        4\nElapsed time:     0min 30sec\nDone:             16 images\n\n```\n\nSee [Usage](#usage) · [Options](#options) · [Examples](#xamples) · [Gamma correction](#gamma-correction) · [Sigmoidal contrast](#sigmoidal-contrast) · [**Issues and FAQ**](#issues-and-faq)\n\n## Tweaking colors\n\nIf you are working on linear TIFFs, e.g. as produced by [Dave Coffin's dcraw](http://cybercom.net/~dcoffin/dcraw/dcraw.1.html) by its `-4` flag, both the negative and the positive will look somehow flat, due to their linearity. The dark negative becomes a very light positive. \n\nThe *positive* utility inverses the negative TIFF to positive, *and exactly now* we are able to perform the very gamma correction that did not take place when `dcraw` created the linear TIFF—with the difference that we can choose the gamma as we like. \n\n### Gamma correction\n\n**Adjust the midtones:** In fact, the light positive must be darkened, using a gamma value lesser than 1. Since such small gamma values are “uncommon” in human-driven image editing, it is easier to talk about  “common” gamma values like 2.2 here. Internally, the script then calculates the reciprocal value (0.45) for darkening.\n\nThe `--gamma` or `-g` option carries the Gamma correction value to apply. It is highly recommended to use this parameter with `--normalize` or `-n`. \n\n\n\n```bash\npositive -adn --gamma 2.2 -o gamma-corrected\npositive -adn -g 2.2 -o gamma-corrected\n```\n \n**Which gamma value to choose?** In fact, the gamma value is completely up to your taste. An appropriate gamma value will be mainly influenced by these two factors:\n\n- **The negative density** which results from your film development workflow,  \n  i.e. its natural contrast and blackness\n- **The digicam exposure** chosen during digitalization,  \n  i.e. how light or dark is your photo from the negative.\n\n**Recommendation:** Always worth trying is `--gamma auto` or `-g auto`. This will calculate a mean medium gray which is quite suitable for images taken in ‘real life’ without extreme exposure. Here are some examples for typical values (according to my personal workflow):\n \ngamma | description\n:-----|:----------\nauto | Calculated gamma, based on mean values. Implies gamma 2.2 and is recommended for ‘real life images’.\n1.0 | No Gamma for linear TIFFs. This is the default value if omitted.\n1.8 | Moderate darkening, resulting in overall light images\n2.2 | Well-known software standard; This is what common photo software would apply.\n3.6 | Smooth tones, not too light\n4.4 | Somehow darker, still mellow. Not too contrasty.\n... | Try your own!\n\n\nRead more about Gamma correction: [Wikipedia](https://en.wikipedia.org/wiki/Gamma_correction) and ImageMagick: [Gamma Adjustments](http://www.imagemagick.org/Usage/color_mods/#level_gamma) and [auto-gamma.](http://www.imagemagick.org/script/command-line-options.php?#auto-gamma)\n\n### Sigmoidal contrast\n\n**Adjust highlights and shadows:** While the gamma correction mainly affects the midtones, the sigmoidal contrast control works on the highlights and shadows, leaving the 50% midtone alone and resulting in a non-linear, s-like curve. Use the `--sigmoidal value` or `-s value` option to enhance the contrast. Quoted from ImageMagick docs: “3 is typical and 20 is a lot.” – Example:\n\n```bash\npositive -adn --g 3.6 --sigmoidal 5 -o nice-contrasts\npositive -adn --g 3.6 -s 5 -o nice-contrasts\n```\n\nRead more: [ImageMagick](http://www.imagemagick.org/Usage/color_mods/#sigmoidal)\n\nSee [Usage](#usage) · [Options](#options) · [Examples](#xamples) · [Gamma correction](#gamma-correction) · [Sigmoidal contrast](#sigmoidal-contrast) · [**Issues and FAQ**](#issues-and-faq)\n\n\n\n\n\n# Workflow Recommendations\n\n## When to crop images?\n\nWhen photographing your negatives, you'll probably use a negatives (film) holder. \n\n- The edges of your RAW photo usually will then have a black frame.  \n- If the window of your negative holder is larger than the negative, your image will also show unlit film areas (i.e., spaces between the single negative frames), resulting in another “white“ frame. These unlit areas will become ‘absolute black’ in your positives version.\n\n### Valid approaches\n\nThe following workflow examples assume your linear TIFFs are framed black and white, having used a negative holder with larger frame window.\n\n#### Approach: Crop first\n\nStart cropping your images and save them as TIF. Be sure to preserve the ICC profile!\n\nRun *positive* with gamma and sigmoidal contrast as needed. When using the `-n` parameter for normalizing colors, both the black and white points will be determined by *the information in your image.* Consequences are: \n\n0. The higher gamma value or sigmoidal contrast you use, the earlier deepest shadows and lights will start blocking.\n0. Underexposured or overexposured images are normalized, that is ‘stretched to histogram edges‘, and may loose their generic underexposured or overexposured look. Images being flat in original may show more film grain.\n\n\n#### Approach: Do not crop\n\nRun *positive* with gamma and sigmoidal contrast as needed. When using the `-n` parameter for normalizing colors, both the black and white points will be determined by *the darkest grays of the negative holder edges and the lightest parts in the unlit negativ areas.* Deepest shadows and lights are now in the (surfluous) frames. Consequences are: \n\n0. You may choose way higher gamma and sigmoidal contrast values.\n0. The look of underexposured or overexposured images will overall stay natural.\n\n\n\n# Changelog\n\n## New Features\n\n### v1.1.0\n- **Long option names** for those preferring self-explanatory options like `--resize`, `--desaturate` and so on.\n- **Improved code quality:** Wrapped main features in single functions; Adhere to Bash best practices and coding standards.\n\n\n\n## Upcoming Features\n\nThese features go into the current major version 1:\n\n- **Star rating filter:** Many photo managers like Lightroom or Bridge let their users reject bad images or rate better ones with ‘stars’. *positive* should get a new CLI option flag to set a minimum rating level. Feel free to discuss this in [issue #6.](https://github.com/tomkyle/negatives-positive/issues/6)\n\n- **Custom configuration files:** Would it not be fine if users could store their favourite options in a configuration file? `~/.negativesrc` or ` ~/positive.conf` or even an *INI, YAML* or *JSON?* Head over to the corresponding [issue #7.](https://github.com/tomkyle/negatives-positive/issues/7)\n\n\n\n## Roadmap to version 2\n\n\n- **The *-r* option will be renamed to *-w*,** as *-r* is more natural for the upcoming *Rating filter*, and so is *-w* for *width*. \n\n- **The *-f* option will be renamed to *-m*,** as the actually performed image action is *mirroring horizontally or vertically*. The option values *flip, flop* and *flipflop* will then become something like *V*, *H* or *VH*.\n\n- **New batch mode trigger:** New sub-command `all` will replace the current `-a` flag, like so: `linear-tiff batch \u003coptions\u003e`. \n\n\n# Issues and FAQ\n\nTo see the full list, head over to the [issues page.](https://github.com/tomkyle/negatives-positive/issues)\n\n**Invalid output profile after converting linear Grayscale TIFFs to positive.**  \nAdobe CC Bridge won't render preview image and Photoshop complains about invalid ICC profile. Current workaround is to use `--desaturate` also on grayscale linear TIFFs. Stay tuned: [issue#8](https://github.com/tomkyle/negatives-positive/issues/8)\n\n**I get a error message “mogrify: delegate library support not built-in”**  \nImageMagick must be compiled with litte-cms2 support. See [issue#1](https://github.com/tomkyle/negatives-positive/issues/1) for details. \n\n\n\n# Development and Contribution\n\n```bash\n$ git clone https://github.com/tomkyle/negatives-positive.git\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomkyle%2Fnegatives-positive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomkyle%2Fnegatives-positive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomkyle%2Fnegatives-positive/lists"}