Git Product home page Git Product logo

process-photos's Introduction

process-photos

This program processes the photos of the schedules from the 1926 Census of Religious Bodies taken for the American Religious Ecologies project.

Useage

The program can take two different kinds of inputs. The most common case is that you have a directory with a batch of images, which will be processed into a different directory. Assuming that this program is stored at the root of directory with all the images, basic usage will look like this. Notice that you will first have to create the directory where you want to store the processed images.

mkdir -p 03-for-import/2019-06-12/box013
./process-photos 02-original/2019-06-12/box013 --out 03-for-import/2019-06-12/box013

If you want pass in a subset of the images in the directory, perhaps for testing, you can pass in a list or glob of images instead.

./process-photos 02-original/2019-06-12/box013/*.JPG --out 03-for-import/2019-06-12/box013

Note that the program will silently skip any images that already exist. You can use the second kind of input above to run a small batch first to make sure the settings are right, but it is up to you to delete the images that were output if they were not processed correctly.

You will need to set the options based on what the original images look like in order to process them correctly. The key options are what direction the images should be rotated, how much of them can be obviously cropped before auto-cropping takes over, and what color the background is. For instance, this is a more typical example:

./process-photos -r cw --background black --crop-width=0.2 --crop-height=0.2 \
    02-original/2019-06-12/box013 --out 03-for-import/2019-06-12/box013

In practice, it can be tedious to set both the output path and the input path. When we are running this on our bulk batches of images, we mirror the directory paths from, e.g., 02-original/2019-06-12/box013/ to 03-for-import/2019-06-12/box013. If you omit the directory with the --out flag and include the --mirror-path flag, it will do this mirroring for you automatically, including creating the subdirectories if necessary. For instance, the command below would create the correct output with the 03-for-import/ directory.

./process-photos --mirror-path 02-original/2019-06-12/box013/IMG_0678.JPG 

See the built-in help for all the options:

./process-photos --help

Compiling and testing

In general, this program should already be available to you on the server. But if you need to build it, you can clone this repository and run make build. Note that because this program uses the CGO bindings in order to build Go Imagick package, some environment variables need to be set. The Makefile takes care of this.

Note that this program assumes an ImageMagick in the 6.x version range is available, both for compiling and available as the convert command in your path. You can get this version of ImageMagick on Mac with brew install imagemagick@6. On Linux that is the version available in most package repositories.

You can test the program on the included images by running make test.

License and acknowledgements

This software is available under the MIT License. See LICENSE.md.

Work on American Religious Ecologies has been made possible in part by generous funding from the National Endowment for the Humanities.

process-photos's People

Contributors

lmullen avatar

Stargazers

Sean P. Myrick V19.1.7.2 avatar Jeri Elizabeth avatar

Watchers

James Cloos avatar Sean P. Myrick V19.1.7.2 avatar

Forkers

seanpm2001

process-photos's Issues

[Enhancement] update jobs parameter logic to be more flexible

if i were to deploy this program to a server dedicated for image processing, i would want to be able to utilize all cores of the server.

if hogging all cores on a multipurpose server is a concern, could update logic to something like 'all but 2 cores'.

Background Color

Update script so that a user can input a background color based on RGB code instead of only by name (ex. black, purple, gray, etc.)

[Enhancement] ignore JPEG file extension case

[releco-images@athena releco-photos]$ ls -l 01-uploaded/test.jpg
-rwxrwxrwx. 1 1024 users 301101 Jan 31 15:43 01-uploaded/test.jpg
[releco-images@athena releco-photos]$ process-photos -b "srgb(0,0,0)" -r cw --out 02-original/ 01-uploaded/test.jpg
2023/01/31 16:10:17 Could not find any images with the extension .JPG.
[releco-images@athena releco-photos]$ mv 01-uploaded/test.jpg 01-uploaded/test.JPG
[releco-images@athena releco-photos]$ process-photos -b "srgb(0,0,0)" -r cw --out 02-original/ 01-uploaded/test.JPG
[releco-images@athena releco-photos]$ ls -l 02-original/test.JPG
-rw-rw-r--. 1 1026 65541 217830 Jan 31 16:10 02-original/test.JPG

not a serious issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.