├── README.md ├── android_filmsim ├── Readme.md ├── Sample_Image │ ├── IMG_20170114_162311.dng │ ├── IMG_20170114_162311.jpg │ └── IMG_20170114_162311_Vista.jpg ├── filmsim.sh └── hald-CLUT │ ├── Agfa APX 25.png │ ├── Agfa Vista 200.png │ ├── Fuji Astia 100F.png │ ├── Fuji Neopan Acros 100.png │ ├── Fuji Provia 100F.png │ ├── Fuji Velvia 50.png │ ├── Ilford Delta 100.png │ ├── Kodak Ektachrome 100 VS.png │ ├── Kodak Kodachrome 25.png │ ├── Kodak Kodachrome 64.png │ ├── Kodak Portra 160 1 -.png │ ├── Kodak T-Max 100.png │ └── Polaroid 664.png ├── attribution_bar_imagemagick.sh ├── build-focusblur ├── build-geeqie ├── build-lhdr ├── build-resynthesizer ├── cmake-fix-case ├── generateDCP ├── gmic └── highlight_bloom_and_photoillustration.gmic ├── panofyForFacebook ├── superres ├── SR.sh ├── readme.md └── sample_images │ ├── IMG_20170127_085822.jpg │ ├── IMG_20170127_085823.jpg │ ├── IMG_20170127_085824.jpg │ ├── IMG_20170127_085825.jpg │ ├── IMG_20170127_085827.jpg │ ├── IMG_20170127_085828.jpg │ ├── IMG_20170127_085829.jpg │ ├── IMG_20170127_085831.jpg │ ├── IMG_20170127_085833.jpg │ ├── IMG_20170127_085834.jpg │ └── sample_outputs │ ├── SR_mean.jpg │ ├── SR_median.jpg │ ├── original_100pcnt.jpg │ ├── original_400pcnt.jpg │ ├── superres_100pcnt.jpg │ └── superres_400pcnt.jpg ├── vidTranscode └── vidTranscode.desktop /README.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | A hodgepodge of scripting goodness from the pixls.us community. 3 | -------------------------------------------------------------------------------- /android_filmsim/Readme.md: -------------------------------------------------------------------------------- 1 | # A full Android FOSS raw imageing pipeline (tutorial) 2 | 3 | As an Android user, amateur photographer, and FOSS advocate, I've long wished for a fully FOSS imaging pipeline on Android. I often use my Android phone for photography. It's always on me and the camera hardware in them keeps getting better and better. There's been some great FOSS Android software improvements recently too. I've finally figured out a fully FOSS pipeline that can go from raw image capture right through to a final, processed image. This post is meant to share the pipeline I've discovered, and I hope it will be a guide for others who want to implement a similar imaging pipeline. 4 | 5 | Before we get started, here's some quick links to all the things you are going to need to pull this off. 6 | 7 | > ***Required Android Apps*** 8 | > 1. [Open Camera](https://f-droid.org/repository/browse/?fdfilter=open+camera&fdid=net.sourceforge.opencamera) 9 | > 2. [Amaze File Manager](https://f-droid.org/repository/browse/?fdfilter=amaze&fdid=com.amaze.filemanager) 10 | > 3. [Termux](https://f-droid.org/repository/browse/?fdfilter=termux&fdid=com.termux) 11 | > 4. [Termux API](https://f-droid.org/repository/browse/?fdfilter=oi&fdid=com.termux.api) 12 | > 5. [Termux Widget](https://f-droid.org/repository/browse/?fdfilter=termux&fdid=com.termux.widget) 13 | > 14 | > ***Required files*** 15 | > 1. The [filmsim.sh](https://github.com/PixlsStuff/Scripts/tree/master/android_filmsim) script. 16 | > 2. Some [hald-CLUT film emulation files](http://blog.patdavid.net/2015/03/film-emulation-in-rawtherapee.html). 17 | 18 | ## Capturing raw images on Android 19 | 20 | This part is easy thanks to the really great [Open Camera](https://f-droid.org/repository/browse/?fdfilter=open+camera&fdid=net.sourceforge.opencamera) app. This is a truly great camera app, with many excellent capabilities. Most importantly to me, it is FOSS, offers manual exposure controls, and allows raw image capture in .dng format. To enable raw image capture, you must have a phone that implements the "Camera2 API". [Here is a list](http://www.smartphonesnap.com/articles/list-android-phones-that-take-raw-photos) of some phones that support this API. My phone is the Nexus 5x, and Open Camera raw capture works very well with it. You must enable this feature to be able to capture raw images 21 | 22 | 1. Within Open Camera, open the settings (cogwheel icon). 23 | 2. Scroll down, and check "Use Camera2 API". 24 | 3. Click the "Photo Settings" option, and tap "RAW" 25 | 4. Select "JPEG and DNG (RAW)". 26 | 27 | Now, you will save both a jpeg and a .dng raw file of every image you shoot with the Open Camera app. 28 | 29 | ## Developing raw images on Android 30 | 31 | This has been the more difficult part of the problem to overcome. But I've recently solved this gap in large part thanks to the very cool FOSS app called [Termux](https://f-droid.org/repository/browse/?fdfilter=termux&fdid=com.termux). Termux is a really brilliant solution to install a minimal Debian-based CLI Linux distro on Android *without the need for root*. Termux is really awesome, and includes many smart ways to interact with the terminal using your phone's hardware keys and onscreen keyboard. Read the help [here](https://termux.com/help.html) to learn some of these shortcuts. They will be useful. Now, what's really cool and useful for us is that you can install several of your favorite command line image processing tools, which the Temux project has precompiled for ARM processors and hosted for you in its apt repository. For us, the two important tools are dcraw and imagemagick. 32 | 33 | #### Setting up Termux 34 | 35 | First things first, however: we need to get Termux installed, and then add a few little bells and whistles that will come in handy. 36 | 37 | 1. Using f-droid (or the Play Store), install the [Termux](https://f-droid.org/repository/browse/?fdfilter=termux&fdid=com.termux) app, the [Termux API](https://f-droid.org/repository/browse/?fdfilter=oi&fdid=com.termux.api) app, and the [Termux Widget](https://f-droid.org/repository/browse/?fdfilter=termux&fdid=com.termux.widget) apps on your phone. 38 | 2. Open a Termux session by tapping on the Termux app. 39 | 3. Update the repositories and upgrade the Termux system to the latest releases: 40 | `apt update && apt upgrade` 41 | 4. Install some packages that our filmsim.sh script requires: 42 | `apt install termux-api coreutils dcraw graphicsmagick`. 43 | 5. Give Termux access to your file storage: 44 | `termux-setup-storage` 45 | A little pop-up will appear asking if you want to give Termux permission to access your file storage. Accept this. 46 | 47 | We now have Termux ready to go, but we aren't finished yet. We will have to arrange some files and get our script set up to be run as widget. We can do that with [Amaze File Manager](https://f-droid.org/repository/browse/?fdfilter=amaze&fdid=com.amaze.filemanager) and from the Termux command line itself. The main directory for Termux is `storage`, and from there you can `cd storage\dcim\`, where you can stage these files in the next steps. 48 | 49 | #### An Android RAW development approach 50 | 51 | The raw development approach that I came up with relies on using your favorite hald CLUTs to alter the colors of your raw images to a final jpeg right from the command line. I use @patdavid's awesome [film emulation hald CLUTs](http://blog.patdavid.net/2015/03/film-emulation-in-rawtherapee.html). This is accomplished using [dcraw](https://www.cybercom.net/~dcoffin/dcraw/) to decode the RAW image, and [graphicsmagick](http://www.graphicsmagick.org/) to apply the hald-CLUT tone adjustments. These two tools are the heart of my filmsim.sh script, which helps you to automate that process. We installed dcraw and graphicsmagick already, but we need to get some other things set up for all this to work: 52 | 53 | 1. Using Amaze File Manager, create a new folder in "dcim" named "haldCLUT." 54 | 2. Extract some of your favorite of Pat's hald CLUT's there (you probably don't want to extract all of them, since they are large files). You can find a couple of my personal favorites [here](https://github.com/PixlsStuff/Scripts/tree/master/android_filmsim). 55 | 3. Download the [filmsim.sh script](https://github.com/PixlsStuff/Scripts/tree/master/android_filmsim) to your downloads directory. 56 | 4. Using Termux, copy to the script to a special location so that it can be used as a widget: 57 | `cp storage/downloads/filmsim.sh $HOME/.shortcuts/filmsim.sh` 58 | 5. We can now install a Termux widget by long-pressing the background of your main Android desktop. Choose the single widget, and choose "filmsim.sh" from the list of available scripts to launch with the widget. You should now see a new button on your Android desktop named "filmsim.sh". We are ready to go! 59 | 60 | #### Let's get processing! 61 | 62 | 1. Capture a raw camera image. Use the Open Shot app on your phone, or use your "real" camera. 63 | 2. If you used an external camera, mount the SD card, or otherwise transfer the raw file of your image to your phone. 64 | 3. Start the "filmsim.sh" script by tapping on the Termux widget icon you created for it in the instructions above. A Termux session will open, and you will be greeted with a series of pop up dialogs to guide you through the operations. 65 | 4. In the first popup dialog, enter the extension of the raw file you will load. For example, enter ".dng" for a raw file in the Adobe DNG format, or ".orf" for a raw file in the Olympus raw format. Don't leave off the "." Tap "Okay" to proceed to the next step. 66 | 5. In the next pop up dialog, navigate to the location of the raw file you want to process. If you use Open Camera, this will be in `/dcim/OpenCamera/`. Note that you can also pull a file directly from a mounted SD card or other connected external storage device. Tap "Okay" to proceed to the next step. 67 | 6. In the next pop up dialog, navigate to the hald-CLUT file you want to use to process the colors in your raw file. This could also be on an external drive. Tap "Okay" to proceed to the next step. 68 | 7. In the final pop up dialog, enter the full name of the processed output file created from your raw image. This should have the appropriate file extension. For example, enter "my_processed_image.jpg" to save out a JPEG, or "my_processed_image.png" to save out a PNG. You can enter any common image file format. Tap "Okay" to start the image processing operation. 69 | 8. Be patient while the program works. If you raw file is large and your phone not so great, this could take a while. 70 | 9. When the operation is done, it will ask you to "Press any key to exit". When you do so, the Termux session will terminate. You can find your image in the `/dcim/Camera` directory. It should also now show up in your gallery app. 71 | 72 | *NOTE: PERHAPS ADD A YOUTUBE VIDEO?* 73 | 74 | #### Code: 75 | 76 | If you want to see how the sausage is made, here's the code from filmsim.sh: 77 | 78 | #!/data/data/com.termux/files/usr/bin/sh 79 | cd storage/dcim/Camera 80 | rawext=`termux-dialog -t "Raw file type" -i "dng"` 81 | rawf="temp."$rawext 82 | hc="haldCLUT.png" 83 | echo > $rawf 84 | echo > $hc 85 | rawfMDSUM=`stat -c %Y $rawf` 86 | echo "Choose the raw file you want to process." 87 | termux-storage-get $rawf 88 | while [ `stat -c %Y $rawf` -eq $rawfMDSUM ]; do 89 | sleep 2 90 | done 91 | echo "Choose the hald-CLUT you want to use." 92 | hcMDSUM=`stat -c %Y $hc` 93 | termux-storage-get $hc 94 | while [ `stat -c %Y $hc` -eq $hcMDSUM ]; do 95 | sleep 2 96 | done 97 | out=`termux-dialog -t "Output image file" -i "example.jpg"` 98 | echo "Processing. Please be patient...." 99 | dcraw -c $rawf | convert - $hc -hald-clut $out 100 | rm $rawf $hc 101 | exit 0 102 | 103 | 104 | #### Notes: 105 | 106 | 1. Dcraw can process pretty much any kind of camera raw file. So you can process any raw file you want. Just tell it the proper file extension when it asks you too. (e.g., .orf for Olympus raw files). 107 | 2. The file picker dialog produced by Termux-API also alloys access to the SD card or external OTG storage. For me, this means I can process .orf raw files from my Olympus OM-D directly from an OTG card reader plugged into the phone. 108 | 3. This makes for a pretty powerful mobile photo studio to go from camera raw to processed JPEG, and then upload to social media with your phone... 109 | 110 | #### Examples: 111 | 112 | Here is a link to a [sample .dng raw image](https://github.com/PixlsStuff/Scripts/blob/master/android_filmsim/Sample_Image/IMG_20170114_162311.dng) captured with my Nexus 5x phone and Open Camera. 113 | 114 | Here's what the image looked like straight out of the camera: 115 | 116 | ![SOOC](https://raw.githubusercontent.com/PixlsStuff/Scripts/master/android_filmsim/Sample_Image/IMG_20170114_162311.jpg) 117 | 118 | Here's what it looks like with a Kodak Vista hald-CLUT applied: 119 | 120 | ![Vista](https://raw.githubusercontent.com/PixlsStuff/Scripts/master/android_filmsim/Sample_Image/IMG_20170114_162311_Vista.jpg) 121 | -------------------------------------------------------------------------------- /android_filmsim/Sample_Image/IMG_20170114_162311.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/Sample_Image/IMG_20170114_162311.dng -------------------------------------------------------------------------------- /android_filmsim/Sample_Image/IMG_20170114_162311.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/Sample_Image/IMG_20170114_162311.jpg -------------------------------------------------------------------------------- /android_filmsim/Sample_Image/IMG_20170114_162311_Vista.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/Sample_Image/IMG_20170114_162311_Vista.jpg -------------------------------------------------------------------------------- /android_filmsim/filmsim.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/sh 2 | cd storage/dcim/Camera 3 | rawext=`termux-dialog -t "Raw file type" -i "dng"` 4 | rawf="temp."$rawext 5 | hc="haldCLUT.png" 6 | echo > $rawf 7 | echo > $hc 8 | rawfMDSUM=`stat -c %Y $rawf` 9 | echo "Choose the raw file you want to process." 10 | termux-storage-get $rawf 11 | while [ `stat -c %Y $rawf` -eq $rawfMDSUM ]; do 12 | sleep 2 13 | done 14 | echo "Choose the hald-CLUT you want to use." 15 | hcMDSUM=`stat -c %Y $hc` 16 | termux-storage-get $hc 17 | while [ `stat -c %Y $hc` -eq $hcMDSUM ]; do 18 | sleep 2 19 | done 20 | out=`termux-dialog -t "Output image file" -i "example.jpg"` 21 | echo "Processing. Please be patient...." 22 | dcraw -c $rawf | convert - $hc -hald-clut $out 23 | rm $rawf $hc 24 | exit 0 25 | -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Agfa APX 25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Agfa APX 25.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Agfa Vista 200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Agfa Vista 200.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Fuji Astia 100F.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Fuji Astia 100F.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Fuji Neopan Acros 100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Fuji Neopan Acros 100.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Fuji Provia 100F.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Fuji Provia 100F.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Fuji Velvia 50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Fuji Velvia 50.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Ilford Delta 100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Ilford Delta 100.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Kodak Ektachrome 100 VS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Kodak Ektachrome 100 VS.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Kodak Kodachrome 25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Kodak Kodachrome 25.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Kodak Kodachrome 64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Kodak Kodachrome 64.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Kodak Portra 160 1 -.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Kodak Portra 160 1 -.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Kodak T-Max 100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Kodak T-Max 100.png -------------------------------------------------------------------------------- /android_filmsim/hald-CLUT/Polaroid 664.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/android_filmsim/hald-CLUT/Polaroid 664.png -------------------------------------------------------------------------------- /attribution_bar_imagemagick.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Version 0.1 4 | # originally from https://discuss.pixls.us/t/annotation-with-imagemagick-watermark-ish/1813/6 5 | 6 | #--------------------------------------------------------------------------- 7 | # Variables. 8 | #--------------------------------------------------------------------------- 9 | 10 | MULTIPLIER=0.05 # Percentage of the image height the footer height will be. 11 | LOGOMULTIPLIER=0.04 # The size of the logo in relation to the image height. 12 | POINTSIZEMULTIPLIER=0.020 # Font size in relation to the image height. 13 | HORIZONTAL_OFFSET=0.015 # How far to indent the logo and text relative to the image height. 14 | LOGODARK="/path/to/your/dark_logo.png" 15 | LOGOBRIGHT="/path/to/your/bright_logo.png" 16 | FONTDARK="srgb(10%,10%,10%)" 17 | FONTBRIGHT="srgb(90%,90%,90%)" 18 | COPYRIGHTHOLDER="Your Name Here" 19 | COMMENTTAG="usercomment" # Change this to 'comment' if if you use that tag. 20 | PREFIX="pixls.us_" # The prefix for the new files. 21 | FORMAT=jpg # Define the output format here. 22 | 23 | ############################################################################ 24 | # WARNING: ONLY TOUCH STUFF BELOW THIS POINT IF YOU KNOW WHAT YOU ARE DOING. 25 | ############################################################################ 26 | 27 | #--------------------------------------------------------------------------- 28 | # Here we go. 29 | #--------------------------------------------------------------------------- 30 | 31 | for i in "$@" 32 | do 33 | 34 | # Extract height and width of the image. 35 | WIDTH=$(identify -quiet -format "%w" "$i") 36 | HEIGHT=$(identify -quiet -format "%h" "$i") 37 | 38 | # Calculate footer height (FH). 39 | FH="$(echo "$HEIGHT*$MULTIPLIER" | bc)" 40 | 41 | # Calculate new image height without logo (IH). 42 | IH="$(echo "$HEIGHT-$FH" | bc)" 43 | 44 | # Calculate logo height (LH). 45 | LH="$(echo "$HEIGHT*$LOGOMULTIPLIER" | bc)" 46 | 47 | # Extract the value of the comment tag. 48 | COMMENT=$(exiftool -s -s -s -m -"$COMMENTTAG" "$i") 49 | 50 | # Extract the average color of the image to use as fill. 51 | FILL=$(convert "$i" -quiet -scale 1x1\! -format '%[pixel:s]' info:-) 52 | 53 | printf " "$i": Dark or bright logo and font? [D/B]" ; read -e -p ": " CHOICE 54 | 55 | case $CHOICE in 56 | [dD]* ) 57 | TEXTCOLOR="$FONTDARK" 58 | LOGO="$LOGODARK" 59 | ;; 60 | 61 | * ) 62 | TEXTCOLOR="$FONTBRIGHT" 63 | LOGO="$LOGOBRIGHT" 64 | ;; 65 | 66 | esac 67 | 68 | # Calculate the pointsize (PS). 69 | PS="$(echo "$HEIGHT*$POINTSIZEMULTIPLIER" | bc)" 70 | 71 | # Get the year for the copyright notice. 72 | FULLDATE=$(exiftool -s -s -s -CreateDate "$i") 73 | YEAR=${FULLDATE:0:4} 74 | 75 | # Calculate horizontal comment offset (HO). 76 | HO="$(echo "$WIDTH*$HORIZONTAL_OFFSET" | bc)" 77 | 78 | # Calculate horizontal logo offset (LO). 79 | LO="$(echo "$WIDTH*$HORIZONTAL_OFFSET*0.75" | bc)" 80 | 81 | # Calculate horizontal copyright offset (CO) 82 | LOGOWIDTH=$(identify -quiet -format "%w" "$LOGO") 83 | LOGOHEIGHT=$(identify -quiet -format "%h" "$LOGO") 84 | RATIO="$(echo "$LOGOHEIGHT/$LH" | bc -l)" 85 | LW="$(echo "$LOGOWIDTH/$RATIO" | bc)" 86 | CO="$(echo "($LO*2)+$LW" | bc)" 87 | 88 | # Do the magic on the image. 89 | convert "$i" -resize x$IH \ 90 | \( +clone \ 91 | -quiet \ 92 | -fill "$FILL" \ 93 | -draw 'color 0,0 reset' \ 94 | -resize x$FH! \ 95 | -fill "$TEXTCOLOR" \ 96 | -pointsize "$PS" \ 97 | -gravity east \ 98 | -annotate +$HO+0 "$COMMENT" \ 99 | -gravity west \ 100 | -annotate +$CO+0 "© $YEAR $COPYRIGHTHOLDER" \ 101 | -gravity west \ 102 | \( "$LOGO" -resize x$LH \) \ 103 | -geometry +$LO+0 -composite \) \ 104 | -append "$PREFIX""${i%.*}"."$FORMAT" 105 | done 106 | -------------------------------------------------------------------------------- /build-focusblur: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # By Morgan Hardwood 3 | # Version 2019-02-21 4 | # This script gets the latest source code for the given program and compiles it. 5 | 6 | # The name of the program, used for the folder names: 7 | prog="focusblur" 8 | 9 | # The name of the compiled executable: 10 | exe="${prog}" 11 | 12 | # The name of the sub-folder, if any, relative to the folder into which the 13 | # compiled executable is placed. 14 | # e.g. If the executable ends up in: 15 | # ~/programs/someProgram/foo/bar/someExecutable 16 | # then set it to: 17 | # exeRelativePath="foo/bar" 18 | # or if the executable ends up in 19 | # ~/programs/someProgram/someExecutable 20 | # then leave it empty: 21 | # exeRelativePath="" 22 | exeRelativePath="" 23 | 24 | # The path to the repository: 25 | repo="https://github.com/JMoerman/gimp-focusblur-plugin.git" 26 | 27 | # No touching below this line, with the exception of the "Compile" section 28 | # ----------------------------------------------------------------------------- 29 | 30 | # The name of the project's standard branch, typically "master": 31 | master="master" 32 | 33 | buildOnly="false" 34 | buildType="release" 35 | 36 | # Removes the trailing forward-slash if one is present 37 | exeRelativePath="${exeRelativePath/%\/}" 38 | # Append forward-slash to exeRelativePath only if it is not empty. 39 | exePath="${exeRelativePath:+${exeRelativePath}/}${exe}" 40 | 41 | # Command-line arguments 42 | OPTIND=1 43 | while getopts "bdh?-" opt; do 44 | case "${opt}" in 45 | b) buildOnly="true" 46 | ;; 47 | d) buildType="debug" 48 | ;; 49 | h|\?|-) printf '%s\n' "This script gets the latest source code for ${prog} and compiles it." \ 50 | "" \ 51 | " -b" \ 52 | " Optional. If specified, the script only compiles the source, it does not try to update the source. If not specified, the source will be updated first." \ 53 | " -d" \ 54 | " Optional. Compile a \"debug\" build. If not specified, a \"release\" build will be made." \ 55 | "" 56 | exit 0 57 | ;; 58 | esac 59 | done 60 | shift $((OPTIND-1)) 61 | [ "$1" = "--" ] && shift 62 | 63 | printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" "" 64 | 65 | # Clone if needed 66 | cloned="false" 67 | updates="false" 68 | if [[ ! -d "$HOME/programs/code-${prog}" ]]; then 69 | mkdir -p "$HOME/programs" || exit 1 70 | git clone "$repo" "$HOME/programs/code-${prog}" || exit 1 71 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 72 | cloned="true" 73 | else 74 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 75 | git fetch 76 | if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then 77 | updates="true" 78 | fi 79 | fi 80 | 81 | # Pull updates if necessary 82 | if [[ "$updates" = "true" && "$buildOnly" = "false" ]]; then 83 | git pull || exit 1 84 | fi 85 | 86 | # Find out which branch git is on 87 | branch="$(git rev-parse --abbrev-ref HEAD)" 88 | 89 | # Set build and install folder names 90 | if [[ $branch = $master && $buildType = release ]]; then 91 | buildDir="$HOME/programs/code-${prog}/build" 92 | installDir="$HOME/programs/${prog}" 93 | else 94 | buildDir="$HOME/programs/code-${prog}/build-${branch}-${buildType}" 95 | installDir="$HOME/programs/${prog}-${branch}-${buildType}" 96 | fi 97 | 98 | existsExe="false" 99 | if [[ -e "${installDir}/${exePath}" ]]; then 100 | existsExe="true" 101 | fi 102 | 103 | # Quit if no updates and build-only flag not set 104 | if [[ "$cloned" = "false" && "$buildOnly" = "false" && "$updates" = "false" && "$existsExe" = "true" ]]; then 105 | printf '%s\n' "No updates, nothing to do." 106 | exit 0 107 | fi 108 | 109 | # Determine CPU count 110 | cpuCount="fail" 111 | if command -v nproc >/dev/null 2>&1; then 112 | cpuCount="$(nproc --all)" 113 | fi 114 | if [[ ! ( $cpuCount -ge 1 && $cpuCount -le 64 ) ]]; then 115 | cpuCount=1 116 | fi 117 | 118 | # Prepare folders 119 | rm -rf "${installDir}" 120 | mkdir -p "${buildDir}" "${installDir}" || exit 1 121 | cd "${buildDir}" || exit 1 122 | 123 | # ----------------------------------------------------------------------------- 124 | # Compile 125 | 126 | # -DCMAKE_INSTALL_BINDIR:STRING="${installDir}" \ 127 | cmake \ 128 | -DCMAKE_CXX_FLAGS="-std=c++11 -Wno-deprecated-declarations -Wno-unused-result" \ 129 | -DCMAKE_BUILD_TYPE="$buildType" \ 130 | -DCMAKE_C_FLAGS="-O2 -pipe" \ 131 | -DCMAKE_CXX_FLAGS="${CMAKE_C_FLAGS}" \ 132 | "$HOME/programs/code-${prog}" || exit 1 133 | 134 | make --jobs="$cpuCount" || exit 1 135 | #make install || exit 1 136 | mv -v "${buildDir}/gimp-plugin-focusblur" "${installDir}" 137 | 138 | # Finished 139 | printf '%s\n' "" \ 140 | "To use ${prog} you have two options:" \ 141 | "- Either add \"${installDir}\" to GIMP > Preferences > Folders > Plug-ins," \ 142 | "- Or copy \"${installDir}/gimp-plugin-focusblur\" to /usr/lib/gimp/2.0/plug-ins/" \ 143 | "" 144 | 145 | popd 1>/dev/null 146 | -------------------------------------------------------------------------------- /build-geeqie: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # By Morgan Hardwood 3 | # Version 2018-01-06 4 | # This script gets the latest source code for the given program and compiles it. 5 | 6 | # The name of the program, used for the folder names: 7 | prog="geeqie" 8 | 9 | # The name of the compiled executable: 10 | exe="${prog}" 11 | 12 | # The name of the sub-folder, if any, relative to the folder into which the 13 | # compiled executable is placed. 14 | # e.g. If the executable ends up in: 15 | # ~/programs/someProgram/foo/bar/someExecutable 16 | # then set it to: 17 | # exeRelativePath="foo/bar" 18 | # or if the executable ends up in 19 | # ~/programs/someProgram/someExecutable 20 | # then leave it empty: 21 | # exeRelativePath="" 22 | exeRelativePath="bin" 23 | 24 | # The path to the repository: 25 | repo="git://www.geeqie.org/geeqie.git" 26 | 27 | # No touching below this line, with the exception of the "Compile" section 28 | # ----------------------------------------------------------------------------- 29 | 30 | # The name of the project's standard branch, typically "master": 31 | master="master" 32 | 33 | buildOnly="false" 34 | buildType="release" 35 | 36 | # Removes the trailing forward-slash if one is present 37 | exeRelativePath="${exeRelativePath/%\/}" 38 | # Append forward-slash to exeRelativePath only if it is not empty. 39 | exePath="${exeRelativePath:+${exeRelativePath}/}${exe}" 40 | 41 | # Command-line arguments 42 | OPTIND=1 43 | while getopts "bdh?-" opt; do 44 | case "${opt}" in 45 | b) buildOnly="true" 46 | ;; 47 | d) buildType="debug" 48 | ;; 49 | h|\?|-) printf '%s\n' "This script gets the latest source code for ${prog} and compiles it." \ 50 | "" \ 51 | " -b" \ 52 | " Optional. If specified, the script only compiles the source, it does not try to update the source. If not specified, the source will be updated first." \ 53 | " -d" \ 54 | " Optional. Compile a \"debug\" build. If not specified, a \"release\" build will be made." \ 55 | "" 56 | exit 0 57 | ;; 58 | esac 59 | done 60 | shift $((OPTIND-1)) 61 | [ "$1" = "--" ] && shift 62 | 63 | printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" "" 64 | 65 | # Clone if needed 66 | cloned="false" 67 | updates="false" 68 | if [[ ! -d "$HOME/programs/code-${prog}" ]]; then 69 | mkdir -p "$HOME/programs" || exit 1 70 | git clone "$repo" "$HOME/programs/code-${prog}" || exit 1 71 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 72 | cloned="true" 73 | else 74 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 75 | git fetch 76 | if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then 77 | updates="true" 78 | fi 79 | fi 80 | 81 | # Pull updates if necessary 82 | if [[ "$updates" = "true" && "$buildOnly" = "false" ]]; then 83 | git pull || exit 1 84 | fi 85 | 86 | # Find out which branch git is on 87 | branch="$(git rev-parse --abbrev-ref HEAD)" 88 | 89 | # Set build and install folder names 90 | # 668f95b0 does not yet support out-of-source builds 91 | buildDir="$HOME/programs/code-${prog}" 92 | if [[ $branch = $master && $buildType = release ]]; then 93 | #buildDir="$HOME/programs/code-${prog}/build" 94 | installDir="$HOME/programs/${prog}" 95 | else 96 | #buildDir="$HOME/programs/code-${prog}/build-${branch}-${buildType}" 97 | installDir="$HOME/programs/${prog}-${branch}-${buildType}" 98 | fi 99 | 100 | existsExe="false" 101 | if [[ -e "${installDir}/${exePath}" ]]; then 102 | existsExe="true" 103 | fi 104 | 105 | # Quit if no updates and build-only flag not set 106 | if [[ "$cloned" = "false" && "$buildOnly" = "false" && "$updates" = "false" && "$existsExe" = "true" ]]; then 107 | printf '%s\n' "No updates, nothing to do." 108 | exit 0 109 | fi 110 | 111 | # Determine CPU count 112 | cpuCount="fail" 113 | if command -v nproc >/dev/null 2>&1; then 114 | cpuCount="$(nproc --all)" 115 | fi 116 | if [[ ! ( $cpuCount -ge 1 && $cpuCount -le 64 ) ]]; then 117 | cpuCount=1 118 | fi 119 | 120 | # Prepare folders 121 | rm -rf "${installDir}" 122 | mkdir -p "${installDir}" || exit 1 123 | cd "${buildDir}" || exit 1 124 | 125 | # ----------------------------------------------------------------------------- 126 | # Compile 127 | 128 | ./autogen.sh --prefix="${installDir}" || exit 1 129 | 130 | make --jobs="$cpuCount" || exit 1 131 | make install || exit 1 132 | 133 | # Finished 134 | printf '%s\n' "" "To run ${prog} type:" "${installDir}/${exePath}" "" 135 | 136 | popd 1>/dev/null 137 | -------------------------------------------------------------------------------- /build-lhdr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # By Morgan Hardwood 3 | # Version 2018-01-06 4 | # This script gets the latest source code for the given program and compiles it. 5 | 6 | # The name of the program, used for the folder names: 7 | prog="lhdr" 8 | 9 | # The name of the compiled executable: 10 | exe="luminance-hdr" 11 | 12 | # The name of the sub-folder, if any, relative to the folder into which the 13 | # compiled executable is placed. 14 | # e.g. If the executable ends up in: 15 | # ~/programs/someProgram/foo/bar/someExecutable 16 | # then set it to: 17 | # exeRelativePath="foo/bar" 18 | # or if the executable ends up in 19 | # ~/programs/someProgram/someExecutable 20 | # then leave it empty: 21 | # exeRelativePath="" 22 | exeRelativePath="bin" 23 | 24 | # The path to the repository: 25 | repo="https://github.com/LuminanceHDR/LuminanceHDR.git" 26 | 27 | # No touching below this line, with the exception of the "Compile" section 28 | # ----------------------------------------------------------------------------- 29 | 30 | # The name of the project's standard branch, typically "master": 31 | master="master" 32 | 33 | buildOnly="false" 34 | buildType="release" 35 | 36 | # Removes the trailing forward-slash if one is present 37 | exeRelativePath="${exeRelativePath/%\/}" 38 | # Append forward-slash to exeRelativePath only if it is not empty. 39 | exePath="${exeRelativePath:+${exeRelativePath}/}${exe}" 40 | 41 | # Command-line arguments 42 | OPTIND=1 43 | while getopts "bdh?-" opt; do 44 | case "${opt}" in 45 | b) buildOnly="true" 46 | ;; 47 | d) buildType="debug" 48 | ;; 49 | h|\?|-) printf '%s\n' "This script gets the latest source code for ${prog} and compiles it." \ 50 | "" \ 51 | " -b" \ 52 | " Optional. If specified, the script only compiles the source, it does not try to update the source. If not specified, the source will be updated first." \ 53 | " -d" \ 54 | " Optional. Compile a \"debug\" build. If not specified, a \"release\" build will be made." \ 55 | "" 56 | exit 0 57 | ;; 58 | esac 59 | done 60 | shift $((OPTIND-1)) 61 | [ "$1" = "--" ] && shift 62 | 63 | printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" "" 64 | 65 | # Clone if needed 66 | cloned="false" 67 | updates="false" 68 | if [[ ! -d "$HOME/programs/code-${prog}" ]]; then 69 | mkdir -p "$HOME/programs" || exit 1 70 | git clone "$repo" "$HOME/programs/code-${prog}" || exit 1 71 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 72 | cloned="true" 73 | else 74 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 75 | git fetch 76 | if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then 77 | updates="true" 78 | fi 79 | fi 80 | 81 | # Pull updates if necessary 82 | if [[ "$updates" = "true" && "$buildOnly" = "false" ]]; then 83 | git pull || exit 1 84 | fi 85 | 86 | # Find out which branch git is on 87 | branch="$(git rev-parse --abbrev-ref HEAD)" 88 | 89 | # Set build and install folder names 90 | if [[ $branch = $master && $buildType = release ]]; then 91 | buildDir="$HOME/programs/code-${prog}/build" 92 | installDir="$HOME/programs/${prog}" 93 | else 94 | buildDir="$HOME/programs/code-${prog}/build-${branch}-${buildType}" 95 | installDir="$HOME/programs/${prog}-${branch}-${buildType}" 96 | fi 97 | 98 | existsExe="false" 99 | if [[ -e "${installDir}/${exePath}" ]]; then 100 | existsExe="true" 101 | fi 102 | 103 | # Quit if no updates and build-only flag not set 104 | if [[ "$cloned" = "false" && "$buildOnly" = "false" && "$updates" = "false" && "$existsExe" = "true" ]]; then 105 | printf '%s\n' "No updates, nothing to do." 106 | exit 0 107 | fi 108 | 109 | # Determine CPU count 110 | cpuCount="fail" 111 | if command -v nproc >/dev/null 2>&1; then 112 | cpuCount="$(nproc --all)" 113 | fi 114 | if [[ ! ( $cpuCount -ge 1 && $cpuCount -le 64 ) ]]; then 115 | cpuCount=1 116 | fi 117 | 118 | # Prepare folders 119 | rm -rf "${installDir}" 120 | mkdir -p "${buildDir}" "${installDir}" || exit 1 121 | cd "${buildDir}" || exit 1 122 | 123 | # ----------------------------------------------------------------------------- 124 | # Compile 125 | 126 | cmake \ 127 | -DCMAKE_CXX_FLAGS="-std=c++11 -Wno-deprecated-declarations -Wno-unused-result" \ 128 | -DCMAKE_INSTALL_PREFIX="${installDir}" \ 129 | -DCMAKE_BUILD_TYPE="$buildType" \ 130 | -DCMAKE_C_FLAGS="-O2 -pipe" \ 131 | -DCMAKE_CXX_FLAGS="${CMAKE_C_FLAGS}" \ 132 | "$HOME/programs/code-${prog}" || exit 1 133 | 134 | make --jobs="$cpuCount" || exit 1 135 | make install || exit 1 136 | 137 | # Finished 138 | printf '%s\n' "" "To run ${prog} type:" "${installDir}/${exePath}" "" 139 | 140 | popd 1>/dev/null 141 | -------------------------------------------------------------------------------- /build-resynthesizer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # By Morgan Hardwood 3 | # Version 2018-01-06 4 | # This script gets the latest source code for the given program and compiles it. 5 | 6 | # The name of the program, used for the folder names: 7 | prog="resynthesizer" 8 | 9 | # The name of the compiled executable: 10 | exe="${prog}" 11 | 12 | # The name of the sub-folder, if any, relative to the folder into which the 13 | # compiled executable is placed. 14 | # e.g. If the executable ends up in: 15 | # ~/programs/someProgram/foo/bar/someExecutable 16 | # then set it to: 17 | # exeRelativePath="foo/bar" 18 | # or if the executable ends up in 19 | # ~/programs/someProgram/someExecutable 20 | # then leave it empty: 21 | # exeRelativePath="" 22 | exeRelativePath="src/resynthesizer" 23 | 24 | # The path to the repository: 25 | repo="https://github.com/bootchk/resynthesizer.git" 26 | 27 | # No touching below this line, with the exception of the "Compile" section 28 | # ----------------------------------------------------------------------------- 29 | 30 | # The name of the project's standard branch, typically "master": 31 | master="master" 32 | 33 | buildOnly="false" 34 | buildType="release" 35 | 36 | # Removes the trailing forward-slash if one is present 37 | exeRelativePath="${exeRelativePath/%\/}" 38 | # Append forward-slash to exeRelativePath only if it is not empty. 39 | exePath="${exeRelativePath:+${exeRelativePath}/}${exe}" 40 | 41 | # Command-line arguments 42 | OPTIND=1 43 | while getopts "bdh?-" opt; do 44 | case "${opt}" in 45 | b) buildOnly="true" 46 | ;; 47 | d) buildType="debug" 48 | ;; 49 | h|\?|-) printf '%s\n' "This script gets the latest source code for ${prog} and compiles it." \ 50 | "" \ 51 | " -b" \ 52 | " Optional. If specified, the script only compiles the source, it does not try to update the source. If not specified, the source will be updated first." \ 53 | " -d" \ 54 | " Optional. Compile a \"debug\" build. If not specified, a \"release\" build will be made." \ 55 | "" 56 | exit 0 57 | ;; 58 | esac 59 | done 60 | shift $((OPTIND-1)) 61 | [ "$1" = "--" ] && shift 62 | 63 | printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" "" 64 | 65 | # Clone if needed 66 | cloned="false" 67 | updates="false" 68 | if [[ ! -d "$HOME/programs/code-${prog}" ]]; then 69 | mkdir -p "$HOME/programs" || exit 1 70 | git clone "$repo" "$HOME/programs/code-${prog}" || exit 1 71 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 72 | cloned="true" 73 | else 74 | pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 75 | git fetch 76 | if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then 77 | updates="true" 78 | fi 79 | fi 80 | 81 | # Pull updates if necessary 82 | if [[ "$updates" = "true" && "$buildOnly" = "false" ]]; then 83 | git pull || exit 1 84 | fi 85 | 86 | # Find out which branch git is on 87 | branch="$(git rev-parse --abbrev-ref HEAD)" 88 | 89 | # Set build and install folder names 90 | if [[ $branch = $master && $buildType = release ]]; then 91 | buildDir="$HOME/programs/code-${prog}/build" 92 | #installDir="$HOME/programs/${prog}" 93 | else 94 | buildDir="$HOME/programs/code-${prog}/build-${branch}-${buildType}" 95 | #installDir="$HOME/programs/${prog}-${branch}-${buildType}" 96 | fi 97 | 98 | #existsExe="false" 99 | #if [[ -e "${installDir}/${exePath}" ]]; then 100 | # existsExe="true" 101 | #fi 102 | 103 | # Quit if no updates and build-only flag not set 104 | #if [[ "$cloned" = "false" && "$buildOnly" = "false" && "$updates" = "false" && "$existsExe" = "true" ]]; then 105 | # printf '%s\n' "No updates, nothing to do." 106 | # exit 0 107 | #fi 108 | 109 | # Determine CPU count 110 | cpuCount="fail" 111 | if command -v nproc >/dev/null 2>&1; then 112 | cpuCount="$(nproc --all)" 113 | fi 114 | if [[ ! ( $cpuCount -ge 1 && $cpuCount -le 64 ) ]]; then 115 | cpuCount=1 116 | fi 117 | 118 | # Prepare folders 119 | rm -rf "${buildDir}" 120 | mkdir -p "${buildDir}" || exit 1 121 | cd "${buildDir}" || exit 1 122 | 123 | # ----------------------------------------------------------------------------- 124 | # Compile 125 | 126 | ../autogen.sh || exit 1 127 | ../configure || exit 1 128 | make --jobs="$cpuCount" CFLAGS='-O3' || exit 1 129 | 130 | printf '%s\n' "" "Enter the sudo password to commence installation." 131 | sudo make install || exit 1 132 | 133 | # Finished 134 | printf '%s\n' "" "Resynthesizer is ready for use in GIMP." "Run GIMP, go to > Preferences > Folders > Plug-ins and make sure that /usr/local/lib/gimp/2.0/plug-ins is in the list - if it is not, add it." "" 135 | 136 | popd 1>/dev/null 137 | -------------------------------------------------------------------------------- /cmake-fix-case: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Recursively finds all CMake files, then converts CMake commands to lowercase 4 | # and removes spaces between command and opening brace. 5 | # 6 | # Usage: 7 | # cd ~/repo 8 | # ~/scripts/cmake-fix-case 9 | 10 | while read -r; do 11 | lcCmd="$REPLY" 12 | ucCmd="${lcCmd^^}" 13 | printf '%s\n' "Replacing \"$ucCmd\" with \"$lcCmd\"..." 14 | find . \( -iname "CMakeLists.txt" -or -iname "*.cmake" \) -exec sed -i -e "s/$ucCmd *(/$lcCmd(/g" -e "s/$lcCmd *(/$lcCmd(/g" {} \; 15 | done < <(cmake --help-command-list | grep -iv 'cmake version') 16 | -------------------------------------------------------------------------------- /generateDCP: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This Bash4 script uses DCamProf and ArgyllCMS to generate DCP profiles. 4 | # It uses Exiv2 or ExifTool to extract the camera model if one is not 5 | # manually provided as a parameter (-c). 6 | # 7 | # Read the RawPedia article, "How to create DCP color profiles". 8 | # Run the script from a folder which contains the DCamProf executable and the 9 | # daylight.tif and/or tungsten.tif files. 10 | # 11 | # Blame DrSlony 12 | # Version 2017-03-06 13 | # Please report bugs or enhancements to https://github.com/Beep6581/RawTherapee 14 | 15 | scaninCmd="argyll-scanin" 16 | exifCmd="" 17 | copyright="RawTherapee CC0" # For a profile to be bundled with RawTherapee it must be in the public domain (CC0). 18 | printFormat='\n\n\n%s ----------------------------------------\n\n' 19 | 20 | # No touching below this line ------------------------------------------------ 21 | 22 | unset exec tungsten daylight suffix 23 | 24 | OPTIND=1 25 | while getopts "c:t:o:g:l:r:h?-" opt; do 26 | case "${opt}" in 27 | c) camera="$OPTARG" 28 | ;; 29 | t) curve="$OPTARG" 30 | ;; 31 | o) tro="$OPTARG" 32 | ;; 33 | g) gamut="$OPTARG" 34 | ;; 35 | l) layout="$OPTARG" 36 | ;; 37 | r) ref="$OPTARG" 38 | ;; 39 | h|\?|-) printf '%s\n' "Usage:" \ 40 | "Run the script from a folder which contains the DCamProf executable and the daylight.tif and/or tungsten.tif files." \ 41 | "" \ 42 | " $0 -c \"\" -t -o -g " \ 43 | "" \ 44 | " -c \"\"" \ 45 | " Optional. Specify the camera name, remember to surround it in double-quotes. If not specified, exiv2 or exiftool are used." \ 46 | "" \ 47 | " -t " \ 48 | " Optional. Specify which tone-curve to embed. If unspecified, defaults to \"acr\"." \ 49 | "" \ 50 | " -o " \ 51 | " Optional. Specify the tone reproduction operator. Only used if -t is \"acr\". If unspecified, defaults to \"neutral\"." \ 52 | "" \ 53 | " -g " \ 54 | " Optional. Specify gamut compression. Only used if -t is \"linear\". If unspecified, defaults to \"none\"." \ 55 | "" \ 56 | " -l " \ 57 | " Optional. Select layout file." \ 58 | " cc = ColorChecker" \ 59 | " ccp = ColorCheckerPassport" \ 60 | " it8 = IT 8.7/2-1993" \ 61 | " Or custom path." \ 62 | " If unspecified, defaults to \"/usr/share/argyllcms/ref/ColorCheckerPassport.cht\"." \ 63 | "" \ 64 | " -r " \ 65 | " Optional. Select reference file." \ 66 | " cc = data-examples/cc24_ref.cie - For ColorChecker24 targets produced before November 2014." \ 67 | " ccnew = data-examples/cc24_ref-new.cie - For ColorChecker24 targets produced from Novermber 2014 onwards." \ 68 | " Or custom path." \ 69 | " If unspecified, defaults to \"data-examples/cc24_ref.cie\"." \ 70 | "" 71 | exit 0 72 | ;; 73 | esac 74 | done 75 | shift $((OPTIND-1)) 76 | [ "$1" = "--" ] && shift 77 | 78 | # Check for dcamprof 79 | if [[ -x ./dcamprof ]]; then 80 | dcamprofCmd="./dcamprof" 81 | else 82 | printf '%s\n' "dcamprof not found, get it from" "http://www.ludd.ltu.se/~torger/dcamprof.html" 83 | exit 0 84 | fi 85 | 86 | # Check for argyll-scanin 87 | command -v "$scaninCmd" >/dev/null 2>&1 88 | if [[ $? -ne 0 ]]; then 89 | command -v scanin >/dev/null 2>&1 90 | if [[ $? -ne 0 ]]; then 91 | printf '%s\n' "DCamProf requires the \"scanin\" command from ArgyllCMS." "Make sure ArgyllCMS is installed." "Could not find a working \"scanin\" command. Aborting." 92 | exit 0 93 | else 94 | scaninCmd="scanin" 95 | fi 96 | fi 97 | 98 | # Check for Exiv2/ExifTool if camera model not provided 99 | if [[ -z $camera ]]; then 100 | command -v exiv2 >/dev/null 2>&1 101 | if [[ $? -ne 0 ]]; then 102 | command -v exiftool >/dev/null 2>&1 103 | if [[ $? -ne 0 ]]; then 104 | printf '%s\n' "Install Exiv2 or ExifTool and re-run this script." "Aborting." 105 | exit 0 106 | else 107 | exifCmd="exiftool -T -Model" 108 | fi 109 | else 110 | exifCmd="exiv2 -g Exif.Image.Model -Pv" 111 | fi 112 | if [[ -e tungsten.tif ]]; then 113 | camera="$(${exifCmd} tungsten.tif)" 114 | if [[ -z $camera ]]; then 115 | printf '%s\n' "Could not find camera model in tungsten.tif's metadata." "Re-run the script and provide the camera model manually." 116 | exit 0 117 | fi 118 | fi 119 | if [[ -e daylight.tif ]]; then 120 | camera="$(${exifCmd} daylight.tif)" 121 | if [[ -z $camera ]]; then 122 | printf '%s\n' "Could not find camera model in daylight.tif's metadata." "Re-run the script and provide the camera model manually." 123 | exit 0 124 | fi 125 | fi 126 | fi 127 | 128 | # Check for input files 129 | if [[ ! -e tungsten.tif && ! -e daylight.tif ]]; then 130 | printf '%s\n' "Neither daylight.tif nor tungsten.tif was found in the current folder. Aborting." 131 | exit 0 132 | fi 133 | 134 | # Assign defaults if parameters not provided. 135 | case "$tro" in 136 | s|standard) tro="standard" ;; 137 | *) tro="neutral" ;; 138 | esac 139 | case "$curve" in 140 | l|linear) curve="linear" ;; 141 | n|none) curve="none" ;; 142 | *) curve="acr" ;; 143 | esac 144 | case "$gamut" in 145 | s|srgb) gamut="srgb" ;; 146 | ss|srgb-strong) gamut="srgb-strong" ;; 147 | a|adobergb) gamut="adobergb" ;; 148 | as|adobergb-strong) gamut="adobergb-strong" ;; 149 | *) gamut="none" ;; 150 | esac 151 | case "$layout" in 152 | cc) layout="/usr/share/argyllcms/ref/ColorChecker.cht" ;; 153 | ccp) layout="/usr/share/argyllcms/ref/ColorCheckerPassport.cht" ;; 154 | it8) layout="/usr/share/argyllcms/ref/it8.cht" ;; 155 | "") layout="/usr/share/argyllcms/ref/ColorChecker.cht" ;; 156 | *) ;; 157 | esac 158 | case "$ref" in 159 | cc|ccold) ref="data-examples/cc24_ref.cie" ;; 160 | ccnew) ref="data-examples/cc24_ref-new.cie" ;; 161 | "") ref="data-examples/cc24_ref.cie" ;; 162 | *) ;; 163 | esac 164 | 165 | # Check for layout file 166 | if [[ ! -e $layout ]]; then 167 | printf '%s\n' "Layout file \"${layout}\" not found. Aborting." 168 | exit 0 169 | fi 170 | 171 | # Check for reference file 172 | if [[ ! -e $ref ]]; then 173 | printf '%s\n' "Reference file \"${ref}\" not found. Aborting." 174 | exit 0 175 | fi 176 | 177 | # Clean up from previous runs. 178 | rm daylight.ti3 daylight.json daylight-diag.tif tungsten.ti3 tungsten.json tungsten-diag.tif 2>/dev/null 179 | 180 | if [[ -e tungsten.tif ]]; then 181 | tungsten="tungsten.tif" 182 | printf "${printFormat}" "${scaninCmd} tungsten" 183 | ${scaninCmd} -v -G 0.454545 -p -digIcrpn tungsten.tif "${layout}" "${ref}" tungsten-diag.tif 184 | printf "${printFormat}" "make-profile tungsten" 185 | ${dcamprofCmd} make-profile -i StdA tungsten.ti3 tungsten.json 2>&1 186 | #${dcamprofCmd} make-profile -i StdA -w all 1.5,1,8,2,1 tungsten.ti3 tungsten1.json 187 | #${dcamprofCmd} make-profile -i StdA -w all 1.5,1,8,2,1 -l 0.1,0.1 tungsten.ti3 tungsten2.json 188 | #${dcamprofCmd} make-profile -i StdA -w all 1.5,1,8,2,1 -l -1,0 tungsten.ti3 tungsten3.json 189 | fi 190 | 191 | if [[ -e daylight.tif ]]; then 192 | daylight="daylight.tif" 193 | printf "${printFormat}" "${scaninCmd} daylight" 194 | "$scaninCmd" -v -G 0.454545 -p -digIcrpn daylight.tif "${layout}" "${ref}" daylight-diag.tif 195 | printf "${printFormat}" "make-profile daylight" 196 | ${dcamprofCmd} make-profile -i D50 -C daylight.ti3 daylight.json 2>&1 197 | #${dcamprofCmd} make-profile -i D50 -C -w all 1.5,1,8,2,1 daylight.ti3 daylight1.json 198 | #${dcamprofCmd} make-profile -i D50 -C -w all 1.5,1,8,2,1 -l 0.1,0.1 daylight.ti3 daylight2.json 199 | #${dcamprofCmd} make-profile -i D50 -C -w all 1.5,1,8,2,1 -l -1,0 daylight.ti3 daylight3.json 200 | fi 201 | 202 | #for relax in {0..3}; do 203 | # ${dcamprofCmd} make-dcp -n "${camera}" -d "${camera}" -c "Morgan Hardwood/RawTherapee" -t acr ${tungsten%.tif}${tungsten:+${relax}.json} ${daylight%.tif}${daylight:+${relax}.json} "${camera} ${relax}.dcp" 204 | #done 205 | 206 | printf "${printFormat}" "make-dcp" 207 | printf '%s\n' "Camera: $camera" "Copyright: $copyright" "Curve: $curve" "TRO: $tro" "Gamut: $gamut" "" 208 | read -r -p "Enter DCP filename suffix, if any: " suffix 209 | echo 210 | # :+ uses an alternate value. If suffix is unset or empty, it expands to nothing, else it expands to " ${suffix}" with the space before the suffix. 211 | ${dcamprofCmd} make-dcp -n "${camera}" -d "${camera}" -c "${copyright}" -t "${curve}" -o "${tro}" -g "${gamut}" ${tungsten%.tif}${tungsten:+.json} ${daylight%.tif}${daylight:+.json} "${camera}${suffix:+ ${suffix}}.dcp" 2>&1 212 | 213 | #ls -lah *.dcp 214 | -------------------------------------------------------------------------------- /gmic/highlight_bloom_and_photoillustration.gmic: -------------------------------------------------------------------------------- 1 | --gimp_anisotropic_smoothing[0] 10,0.16,0.63,0.6,2.35,0.8,30,2,0,1,1,0,1 2 | 3 | -sub[0] [1] 4 | 5 | -simplelocalcontrast_p[1] 25,1,50,1,1,1.2,1,1,1,1,1,1 6 | -gimp_graphic_novelfxl[1] 1,2,6,5,20,0,1,100,0,1,0,0.78,1.92,0,0,2,1,1,1,1.26,0.37,1.05 7 | -add 8 | -c 0,255 9 | -------------------------------------------------------------------------------- /panofyForFacebook: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Adds metadata to images so that Facebook displays them as panoramas. 3 | # https://discuss.pixls.us/t/panorama-mode-in-facebook/3585 4 | # By Harry Durgin and Morgan Hardwood 5 | 6 | if [[ ! -f ${1} ]]; then 7 | printf '%s\n' "No input file specified or file not found." "Aborting." 8 | exit 1 9 | fi 10 | 11 | hfov=0 12 | while [[ hfov -lt 100 || hfov -gt 360 ]]; do 13 | read -r -p "Enter horizontal field of view (100-360): " hfov 14 | done 15 | 16 | for f in "${@}"; do 17 | printf '%s\n' "" "Processing: $f" 18 | 19 | width="$(exiftool -T -ImageWidth "${f}")" 20 | height="$(exiftool -T -ImageHeight "${f}")" 21 | ratio=$((width/height)) 22 | 23 | if [[ ratio -lt 2 ]]; then 24 | printf '%s\n' "Image must have a ratio of at least 2:1." "Skipping." 25 | continue 26 | fi 27 | 28 | width_full=$((360*width/hfov)) 29 | height_full=$((180*width_full/hfov)) 30 | height_full=$((width_full/2)) 31 | left_crop=$(((width_full-width)/2)) 32 | top_crop=$(((height_full-height)/2)) 33 | 34 | exiftool \ 35 | -overwrite_original \ 36 | -FullPanoWidthPixels="$width_full" \ 37 | -FullPanoHeightPixels="$height_full" \ 38 | -CroppedAreaLeftPixels="$left_crop" \ 39 | -CroppedAreaTopPixels="$top_crop" \ 40 | -CroppedAreaImageWidthPixels="$width" \ 41 | -CroppedAreaImageHeightPixels="$height" \ 42 | -ProjectionType=equirectangular \ 43 | -UsePanoramaViewer=True \ 44 | "$f" 45 | done 46 | -------------------------------------------------------------------------------- /superres/SR.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## This is a script to create a 'super resolution' image from a stack of lower resolution images 4 | 5 | mkdir -p resized || exit 1 # make a new directory to hold resized images 6 | convert *.jpg -resize 200% ./resized/%04d.jpg # upscale images by 200% (4x more pixels) and copy to new directory 7 | cd ./resized || exit 1 8 | align_image_stack --use-given-order --distortion -C -z -a al --corr=0.8 -t 1 -c 100 -v *.jpg # auto-align resized images and crop all of them to aligned area 9 | cd .. 10 | convert ./resized/al* -evaluate-sequence mean SR_mean.jpg # calculate average at each new pixel 11 | convert ./resized/al* -evaluate-sequence median SR_median.jpg # calculate median at each new pixel 12 | 13 | #rmdir -fr resized # remove interm images 14 | 15 | echo "Script complete. If all went well, look for superresolution images entitled SR_mean.jpg and SR_median.jpg in the working directory" 16 | 17 | exit 0 18 | -------------------------------------------------------------------------------- /superres/readme.md: -------------------------------------------------------------------------------- 1 | ### This is a Linux shell script to create a 'super resolution' image from a stack of lower resolution images. 2 | 3 | *** 4 | 5 | 6 | ## USAGE: 7 | 8 | `./SR.sh` 9 | 10 | ## DIRECTIONS: 11 | 12 | Place this script into a directory containing a sequential series of ".jpg" images of the same scene. Images should be taken hand-held with any image stabilization off, and with a fast shutter speed to avoid motion blur. They should have been taken in quick succession to avoid changes in lighting conditions or other movements in the scene. At least 8 or 10 images are needed, and probably no more than 20. 13 | Open a terminal in this directory and execute the script with `./SR.sh`. It will create a new subdirectory for the aligned images, and will produce two output "super resolution" images with detail at twice the resolution of the input images. One, `SR_mean.jpg` uses the mean of the image stack to calculate the final pixel values (better luminosity values and potential increase in dynamic range. Chance of "ghosting" if images not perfectly aligned). The other, `SR_median.jpg` will use the median value (better sharpness, perhaps, and less chance of ghosting effects). 14 | 15 | ## SAMPLE IMAGES: 16 | 17 | I've included a small series of sample images so that you can test the script on your system, which can be found in the `sample_images` subdirectory. These are a series of 8 megapixel jpeg images shot with a Nexus 5x Android phone, handheld, using the awesome Open Camera app (FOSS!). The images suffer from some fairly severe barrel distortion, so the corners will be soft after the procedure unless the distortion is corrected before hand. The images are of my bookshelf here in my campus office, which offers enough detail to see the difference between the original 8 megapixel versions, and the ~32 megapixel result of the super resolution. You can use these images to experiment with the script, but here are some results using the default values (shown at a 400% crop): 18 | 19 | ---------------- **Orignal image** -------------------------------- **Superresolution** ---------------- 20 | 21 | ![Original 400% crop](sample_images/sample_outputs/original_400pcnt.jpg "Original 400% crop") ![Superresolution 400% crop](sample_images/sample_outputs/superres_400pcnt.jpg "Superresolution 400% crop") 22 | 23 | ## HINTS: 24 | 25 | 1. Ensure the script is executable with `chmod 755`. 26 | 2. If you want the script to automatically remove the temporary resized or aligned versions of the images after the script is finished, you can uncomment the last line of the script: `#rmdir -fr resized # remove interm images`. otherwise you can manually delete the directory yourself. 27 | 3. I chose default values for `align_image_stack` that seemed to work well with my test images. You may find that you need to alter some of the variables for best results with your own images. I suggest reading about `align_image_stack` [here](http://wiki.panotools.org/Align_image_stack) and [here](http://photo.stackexchange.com/questions/83178/cannot-align-images-with-align-image-stack). In particular, you may need to adjust the number of control points (the number after the `-c` in the `align_image_stack` command) 28 | 4. This technique is fairly computationally expensive, so it may take some time. Set it in motion, and then go make a sandwich! 29 | 30 | ## DEPENDS: 31 | 32 | You must have imagemagick and hugin-tools installed. The script invokes `convert` from imagemagick to do the upscaling and image averaging, and `align_image_stack` from hugin-tools to align the hand held images. On *buntu distros, install them with apt: `sudo apt-get install imagemagick hugin-tools` or with your favorite package manager. -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085822.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085822.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085823.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085823.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085824.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085824.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085825.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085825.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085827.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085827.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085828.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085828.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085829.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085829.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085831.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085831.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085833.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085833.jpg -------------------------------------------------------------------------------- /superres/sample_images/IMG_20170127_085834.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/IMG_20170127_085834.jpg -------------------------------------------------------------------------------- /superres/sample_images/sample_outputs/SR_mean.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/sample_outputs/SR_mean.jpg -------------------------------------------------------------------------------- /superres/sample_images/sample_outputs/SR_median.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/sample_outputs/SR_median.jpg -------------------------------------------------------------------------------- /superres/sample_images/sample_outputs/original_100pcnt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/sample_outputs/original_100pcnt.jpg -------------------------------------------------------------------------------- /superres/sample_images/sample_outputs/original_400pcnt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/sample_outputs/original_400pcnt.jpg -------------------------------------------------------------------------------- /superres/sample_images/sample_outputs/superres_100pcnt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/sample_outputs/superres_100pcnt.jpg -------------------------------------------------------------------------------- /superres/sample_images/sample_outputs/superres_400pcnt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixlsus/Scripts/c9fd04cfc088fa2f87df301cc379d19c7763b59d/superres/sample_images/sample_outputs/superres_400pcnt.jpg -------------------------------------------------------------------------------- /vidTranscode: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # vidTranscode 4 | # Version: 2017-03-06 5 | # By: DrSlony 6 | # Licence: CC0 7 | # 8 | # This Bash script transcodes the specificed video files (wildcards supported) to lossy h.264 format in an MP4 container. 9 | # 10 | # Usage: 11 | # ./vidTranscode