Giter Club home page Giter Club logo

imajen's Introduction

What is Imajen?

Imajen is a framework for procedural image generation. It allows you to render an image describe via functions. It is written in Clojure, and lets you use higher order functions (such as composition) to build your images from simple pieces.

Getting Started

Installing Imajen

Until Imajen is officially released, you must “manually” install it to your local Maven repository.

  1. Clone the repository: git clone https://github.com/davisn/imajen.git
  2. Build and install with lein install

Alternatively, you may use Leiningen to build a jar file and add the jar file (along with all dependencies) to your classpath.

Adding Imajen to your classpath

To use Imajen, you must first ensure it is on your classpath. Using Leiningen, simply add the following to your project.clj dependencies:

[imajen "0.1.0-SNAPSHOT"]

Note: Because there is no official release yet, you must install Imajen first to your local Maven repository using the installation directions above.

Using Imajen in your Application

First import the necessary imajen namespaces:

(use 'com.positronic-solutions.imajen)
(use 'com.positronic-solutions.imajen.view)

The quickest way to generate and view and image is via show-function. show-function accepts a function and does the following:

  • Create a JFrame containing a Canvas
  • Create a BufferedImage to hold the generated image. This image has the same dimensions as the Canvas.
  • Render the BufferedImage. The pixel values are determined by the value returned by applying the function to parameters x and y. x and y correspond to the pixel location, but are (independently) normalized over the domain [0,1].
  • Once the BufferedImage has been rendered, render the image to the Canvas.

The following code illustrates how to render an image having constant color (blue):

(show-function (constantly [0 0 1]))

Of course, you will get more interesting results if you apply show-fuction to a more interesting function. You may use any function, as long as it obeys the following rules:

  1. The function must accept two arguments. These arguments will range from 0 to 1, and will correspond to the current pixel being rendered.
  2. The function must return a vector containing three elements. These elements must be numbers and should be in the range [0 1]. They correspond to (in order) the red, green, and blue values respectively of the pixel being rendered.

Status

Imajen is currently in a pre-alpha development state. As a result, what little API exists at this point is subject to severe and incompatible changes. Documentation is virtually non-existant at this point.

However, Imajen is actively developed, so this will not be the situation forever.

License

Imajen is licensed under the GNU Lesser General Public License (LGPL).

imajen's People

Contributors

davisn avatar

Stargazers

 avatar

Watchers

 avatar

imajen's Issues

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.