Giter VIP home page Giter VIP logo

inky-photo-prep's Introduction

inky-photo-prep

Preprocessor for photos to display on the Inky Impression eInk display

Purpose

I made this thing to process a bunch of my photos for display on the Inky Impression 7 color eInk display.

It does the following:

  • Converts all HEIC files in the input directory to JPGs (also in the input directory)
    • Make sure none of your input files have weird filenames because I haven't bothered to escape any characters in the call to ImageMagick.
  • For each photo:
    • Runs facial detection
    • Determines a center point for cropping, which is the center of all detected faces or just the center of the photo if no faces were detected.
    • Crops the photo according to the above to fit the target display.
    • Dithers the photo to match the defined color palette (Inky Impression by default)
    • Writes the resulting image to the output directory

Installation and Running

You will need Java and Maven for this because I haven't bothered to upload a JAR anywhere. You will also need ImageMagick installed for the HEIC conversion to work.

Run mvn clean compile exec:java -Dexec.args="$input $output" where input is the relative path to your directory of input images, and output is the relative path to where you want your output images.

Configuration

I was too lazy to extract most config to a file or args. All parameters are constants in code that you can diddle with. See the constants at the top of Main.kt and net.djvk.inkyPhotoPrep.PatternDitherer especially.

FAQs

  1. Why didn't you do this in Python, where face detection is easier to use and there's already sample code from Pimoroni for dithering?
    1. No good reason. I usually prefer Kotlin and can generally find a Java library for any of my purposes, but that kind of backfired this time, and I was too deep in the ol' sunk cost fallacy to change course.
  2. Why is Maven installing a zillion versions of JavaCPP?
    1. Maven isn't great at architecture-specific dependencies, so it's just carpet bombing. See here for instructions on how to limit your downloads.

inky-photo-prep's People

Contributors

dvankley avatar

Watchers

 avatar

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.