Python script for preparing MLP images for use in the field
- Press the green button that says Code and select download as zip.
- Unzip the folder and move to location of choice (usually better to keep it on the local drive rather than anywhere on the cloud)
- Keep the name MLP_img_prep for the folder (and make sure it’s not nested from unzipping it)
- Check whether Python is installed (instructions here)
- If Python is not installed, install it from the Python website (instructions here)
The virtual environment will allow you to install Python libraries without risking conflict with other projects.
-
Open File Explorer or Finder and navigate to the folder with your code.
-
Open Command Line or Terminal (from start, type Command Line for Windows or Terminal for Mac and open the first result)
-
Type the following:
Windows:
py -m venv MLP_img_prepMac:
python3 -m venv MLP_img_prep
-
Open Command Line or Terminal (from start, type Command Line for Windows or Terminal for Mac and open the first result)
-
Type the following:
Windows:
MLP_img_prep\Scripts\activateMac:
source MLP_img_prep/bin/activate
Your command prompt should now have MLP_image_prep in brackets before the cursor.
-
Upgrade pip (type the following in command line)
Windows:
py -m pip install --upgrade pipMac:
Python3 -m pip install --upgrade pip -
Install numpy
Windows:
py -m pip install numpyMac:
Python3 -m pip install numpy -
Install pillow
Windows:
py -m pip install pillowMac:
Python3 -m pip install pillow -
Install tkinter
Windows:
py -m pip install tkMac:
Python3 -m pip install tk
- Download all images from Explorer
- Edit in Affinity Photo
- Store all images from one station in a folder, each station should have its own folder
- Images should be named to correspond to their name in Explorer (e-copy number is best)
MAKE SURE YOUR ENVIRONMENT IS ACTIVE BEFORE DOING THIS, IF NOT, RETURN TO STEP 4.
-
In the command line, navigate to the directory for the code (notice the different slashes on Windows vs Mac). Replace the words Folder with the correct path to your MLP_image_prep folder.
-
To find the path on Windows, navigate to the MLP_image_prep.py file in File Explorer, right click, choose properties, and check the File location under details
-
To find the path on Mac, navigate to the MLP_image_prep.py file in Finder, right click, choose Get Info, and check Where
Windows:
cd C:\Folder\Folder\MLP_img_prepMac:
cd /Folder/Folder/MLP_img_prep -
-
Run the script
Windows:
py MLP_image_prep.pyMac:
Python3 MLP_image_prep.py -
Fill in the surveyor name, survey year, and station name when prompted
-
A window will pop up: Navigate to the folder containing your images
-
After a minute, a second window will pop up: Navigate to the folder where you want to save the completed PDF