Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blocknotes/magickwand-crystal
Crystal C bindings for MagickWand library
https://github.com/blocknotes/magickwand-crystal
crystal imagemagick magickwand
Last synced: about 1 month ago
JSON representation
Crystal C bindings for MagickWand library
- Host: GitHub
- URL: https://github.com/blocknotes/magickwand-crystal
- Owner: blocknotes
- License: mit
- Archived: true
- Created: 2017-01-01T13:23:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-19T08:40:00.000Z (over 1 year ago)
- Last Synced: 2024-08-01T17:35:43.196Z (4 months ago)
- Topics: crystal, imagemagick, magickwand
- Language: Crystal
- Size: 483 KB
- Stars: 67
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - magickwand-crystal - Bindings for [MagickWand](https://www.imagemagick.org/script/magick-wand.php), the C interface for ImageMagick processing libraries (Image processing)
- awesome-crystal - magickwand-crystal - Bindings for [MagickWand](https://www.imagemagick.org/script/magick-wand.php), the C interface for ImageMagick processing libraries (Image processing)
README
# MagickWand for Crystal - PROJECT UNMAINTAINED
> *This project is not maintained anymore*
>
> *If you like it or continue to use it fork it please.** * *
* * *Crystal C bindings for MagickWand library, an interface to use the ImageMagick image processing libraries - see [www.imagemagick.org](https://www.imagemagick.org/script/magick-wand.php)
**NOTE**: Base on _ImageMagick-7.0.8-66_. MagickWand is a quite large library, if you find something missing [contact me](http://www.blocknot.es/me)
## Requirements
- *libMagickWand* must be installed
- *pkg-config* must be available## Installation
- Add this to your application's `shard.yml`:
```yaml
dependencies:
magickwand-crystal:
github: blocknotes/magickwand-crystal
```## Usage
Get image info:
```ruby
require "magickwand-crystal"
LibMagick.magickWandGenesis # lib init
wand = LibMagick.newMagickWand # lib init
if LibMagick.magickReadImage( wand, "test.png" )
puts LibMagick.magickGetImageWidth wand
puts LibMagick.magickGetImageHeight wand
end
LibMagick.destroyMagickWand wand # lib deinit
LibMagick.magickWandTerminus # lib deinit
```Scale image and save in Jpeg format:
```ruby
require "magickwand-crystal"
# ... lib init ...
LibMagick.magickReadImage wand, "test.png"
LibMagick.magickScaleImage wand, 320, 240
LibMagick.magickWriteImage wand, "test2.jpg"
# ... lib deinit ...
```Convert to grayscale:
```ruby
require "magickwand-crystal"
# ... lib init ...
LibMagick.magickReadImage wand, "test.jpg"
LibMagick.magickTransformImageColorspace wand, LibMagick::ColorspaceType::GRAYColorspace
LibMagick.magickWriteImage wand, "grayscale.jpg"
# ... lib deinit ...
```## More examples
See [examples](https://github.com/blocknotes/magickwand-crystal/tree/master/examples) folder. There is also an example to generate an image on the fly with Kemal.
## Documentation
The functions mapped have the same names of the MagickWand C library but with the first letter in lowercase.
Example: `MagickWandGenesis` => `LibMagick.magickWandGenesis`
- [MagickWand C Documentation](https://www.imagemagick.org/api/MagickWand/index.html)
- [MagickWand Examples in C](http://members.shaw.ca/el.supremo/MagickWand/)## Notes
Branches with different ImageMagick version:
- **im_6.9.7-3**
- **im_7.0.4-1**The Crystal Magic Wand ! :)
Sounds funny but I hope you find it a useful piece of software.
## Contributors
- [Mattia Roccoberton](http://blocknot.es) - creator, maintainer, Crystal fan :)