Giter VIP home page Giter VIP logo

polycrates's Introduction

Polycrates

===============

Polycrates is an python script that separates and stacks the layers of PSD files into separate png files. It takes a folder srcdir as its single argument, and for each PSD file f in the folder, it generates a sequence of png files of the form $f_01.png, $f_02.png, โ€ฆ $f_$N.png, where N is the number of layers in $f.psd. It then places these files in a folder $srcdir_presentation. It also resizes these files to 25% of the original size and places them in a folder $srcdir_upload.

Suppose that a file Images/A.psd has 4 layers and a file Images/B.psd has 2 layers. The running the script on the folder Images will produce create a folder Images_presentation

Images_presentation/
	A_01.png
	A_02.png
	A_03.png
	A_04.png
	B_01.png
	B_02.png

and a parallel folder Images_upload with the smaller images.

MacOS Installation

The script depends on python and the ImageMagick library. Python is installed by default on MacOS.

Installing ImageMagick on MacOS

First, test to see if you have ImageMagick's command line tools already. Typing

$ which convert

in the Terminal should give the path to an executable (often in /usr/local/bin but sometimes in a user's diretory). To confirm that this is the correct convert executable, type

$ convert logo: logo.gif
$ open logo.gif

which should open an image of a wizard.

If this fails, then install ImageMagick with Homebrew. To install Homebrew itself run in the Terminal

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

If you haven't already, you should also run

$ sudo brew doctor

Assuming that everything went okay, you may then install ImageMagick with

$ sudo brew install imagemagick

Creating a Droplet on MacOS

To convert the script to a droplet in Finder

  1. Open Automator from the Applications folder
  2. Choose Workflow for the type of Document
  3. Drag "Run Shell Script" (under Utilities) from the Actions Menu to the workflow.
  4. Change the shell selector to "/usr/bin/python."
  5. Change the "Pass input" selector to "as arguments."
  6. Copy and paste the contents of polycrates.py to replace the default script.
  7. Save and choose "Application" as the file format.

Windows Installation

The script depends on pythonwin32 and the ImageMagick library.

Installing Python on Windows

Download pywin32 (python extension for windows), choosing the latest version for python 2.7.

To confirm that python was installed properly, type

python --version

in the cmd window, which should give the version (e.g. Python 2.7.2).

Installing ImageMagick on Windows

To test if ImageMagick is installed already, type in a cmd window

$ convert logo: logo.gif
$ imdisplay logo.gif

which should display an image of a wizard.

If this fails, then download the latest binary release from here. Repeat the test above.

Creating a Droplet on Windows

Simply copy the file polycrates.py to the desired location and add shortcuts to suite the user needs. With pywin32 installed, Windows should recognize the file an a python script from the .py suffix.

Contact

Please direct equations to Charles Brubaker at [email protected].

polycrates's People

Contributors

scbrubaker02 avatar

Watchers

Calvin Hu 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.