intridea / pictopus
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (2)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.document | Thu Oct 08 10:19:50 -0700 2009 | |
| |
.gitignore | Thu Oct 08 10:19:50 -0700 2009 | |
| |
LICENSE | Tue Oct 27 20:13:35 -0700 2009 | |
| |
README.rdoc | Sun Nov 15 06:08:04 -0800 2009 | |
| |
Rakefile | Tue Oct 27 20:21:53 -0700 2009 | |
| |
VERSION | Sun Nov 15 06:10:32 -0800 2009 | |
| |
lib/ | Sun Nov 15 06:08:04 -0800 2009 | |
| |
pictopus.gemspec | Sun Nov 15 06:10:43 -0800 2009 | |
| |
rails/ | Sun Nov 15 06:08:04 -0800 2009 | |
| |
spec/ | Sun Nov 15 06:10:15 -0800 2009 |
Pictopus
Pictopus is a Rack developer tool that allows you to use ImageMagick to automatically generate gradient images to use in your design. It is implemented using Rack middleware for the routing and simply runs ImageMagick through the command line (using the ‘convert’ command).
Installation
Pictopus is available as a gem on Gemcutter.
gem install pictopus
To include it in your Rails application, add this to your development.rb file (NOTE: It is not recommended to include the Pictopus gem in your production environment).
config.gem 'pictopus'
To include it in your Rack application, simply add these lines to your rackup:
require 'rack/pictopus'
use Rack::Pictopus, '/path/to/your/static/dir'
Usage
If you have ImageMagick installed in your system, you can create arbitrary gradient images just by naming them as a URL. They will automatically be created by ImageMagick and cached to your public directory, meaning that the generation happens once. You can then check them into your repository and your production environment will treat them like any other image.
To create a gradient using Pictopus, just query a path like this:
/images/pictopus/gradient/fff.000.v.100.png
In this case, a 1x100 image with a vertical white to black gradient would be created. The structure of the image filename is:
:start_color.:end_color.:orientation.:size.:format
For a more complete description of the options:
- :start_color - The color for the top (or left) of the gradient.
- :end_color - The color for the bottom (or right) of the gradient.
- :orientation - "v" for a vertical gradient (top to bottom) or "h" for a horizontal one.
- :size - The size of the image. If only one number is supplied, the image will be 1 pixel wide or high depending on orientation. To create a multi-dimensional image simply specify it in wxh for example 50x100.
Colors
Colors are described in web hex code, with acceptable formats including RRGGBB, RGB, and RRGGBBAA (for .png images only).
Future
While this is a ridiculously simple tool for the time being, it is helpful for me in rapidly prototyping websites without getting bogged down in Photoshop. In the future, I hope to bring together more powerful functionality, perhaps drawing inspiration from the AJAX Spinner Generator and other similar sites to create additional "commands".
Note on Patches/Pull Requests
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don’t break it in a future version unintentionally.
- Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send us a pull request. Bonus points for topic branches.
Copyright
Copyright © 2009 Intridea, Inc. and Michael Bleigh See LICENSE for details.
