Ruby bindings for ImageMagick
翻譯準備中
開發工具C++ · RubyGitHub @rmagick自行安裝營運者未確認
試用過了嗎? 點一下就好,不需要登入。
製作者的介紹僅有上面的一句話。 更多詳情請閱讀儲存庫 README。 儲存庫 README ↗
正在載入完整 README。
檢視完整 README ↗RMagick is an interface between the Ruby programming language and the ImageMagick image processing library.
These prerequisites are required for the latest version of RMagick.
OS
C++ compiler
Ruby
You can get Ruby from https://www.ruby-lang.org.
Ruby must be able to build C-Extensions (e.g. MRI, not JRuby)
ImageMagick
You can get ImageMagick from https://imagemagick.org.
On Debian-based, you can run:
apt install libmagickwand-dev
On RHEL-compatible, you can run:
dnf install ImageMagick-devel
On Arch Linux, you can run:
pacman -Syy imagemagick
On Alpine Linux, you can run:
apk add imagemagick imagemagick-dev imagemagick-libs
or you can run if you would like to use ImageMagick 6:
apk add imagemagick6 imagemagick6-dev imagemagick6-libs
On macOS, you can run:
brew install imagemagick
or you can run if you would like to use ImageMagick 6:
brew install imagemagick@6
ImageMagick-7.XXXX-Q16-x64-dll.exe (not, ImageMagick-7.XXXX-Q16-x64-static.exe) binary from Windows Binary Release, or you can download ImageMagick 6 from Windows Binary Release.Add application directory to your system path and Install development headers for C and C++ in an installer for RMagick.
If you want to install ImageMagick using winget, run the following command:
winget install ImageMagick.ImageMagick --custom /TASKS=modifypath,install_Devel
If you want to install ImageMagick using Chocolatey, run the following command:
choco install imagemagick -PackageParameters InstallDevelopmentHeaders=true
If you are using RubyInstaller for Windows, you can easily install ImageMagick using MSYS2's pacman package manager.
Open your command prompt and run the appropriate command for your architecture to install ImageMagick:
For x64:
ridk exec pacman -S mingw-w64-ucrt-x86_64-imagemagick
For ARM64:
ridk exec pacman -S mingw-w64-clang-aarch64-imagemagick
[!NOTE] When you update the ImageMagick version, we have recommended you should re-install RMagick.
Add to your Gemfile:
gem 'rmagick'
Then run:
bundle install
For Windows, you need to run using ridk tool:
ridk exec bundle install
Run:
gem install rmagick
For Windows, you need to run using ridk tool:
ridk exec gem install rmagick
RMagick is versioned according to Semantic Versioning.
Versions >= 7 work on Ruby >= 3.2 only.
For older Ruby versions, use RMagick ~> 6.0.
Require RMagick in your project as follows:
require 'rmagick'
See https://rmagick.github.io/usage.html for links to more information.
RMagick releases the GVL while ImageMagick works, so calls on different images run in parallel.
Async::Scheduler.new(worker_pool: IO::Event::WorkerPool.new), runs heavy calls on its workers, and the other fibers keep running. While such a call uses an image, using that image from another fiber, or from another Ractor that shares it frozen, raises RuntimeError ("object is in use by another fiber").Async::Semaphore.Thread#raise, Timeout and Ctrl-C reach a thread after the ImageMagick call returns. An exception raised in a trap handler can unwind through ImageMagick instead.MAGICK_THREAD_LIMIT=1.The RMagick installation FAQ has answers to the most commonly reported problems, though may be out of date.
Typically this message means that one or more of the libraries that ImageMagick depends on hasn't been installed. Examine the mkmf.log file in the ext/RMagick subdirectory of the installation directory for any error messages. These messages typically contain enough additional information for you to be able to diagnose the problem. Also see this FAQ.
If you get a message like this:
... /core_ext/kernel_require.rb>:136:in `require': cannot load such file -- RMagick2.so (LoadError)
(snip)
you probably do not have the directory in which the ImageMagick library
is installed in your load path. An easy way to fix this is to define
the directory in the LD_LIBRARY_PATH environment variable. For
example, suppose you installed the ImageMagick library libMagickCore-XXXX.so in
/usr/local/lib. (By default this is where it is installed.) Create the
LD_LIBRARY_PATH variable like this:
export LD_LIBRARY_PATH=/usr/local/lib
On Linux, see ld(1) and ld.so(8) for more information. On other operating
systems, see the documentation for the dynamic loading facility.
This operation might not be required when you can use 4.2.5 or later.
Default stack size of your operating system might be too small. Try removing the limit with this command:
ulimit -s unlimited
If you upgrade to a newer release of ImageMagick, make sure you're using a release of RMagick that supports that release. It's safe to install a new release of RMagick over an earlier release.
You can find more sample RMagick programs in the /examples and /doc/ex directories. These programs are not installed in the RMagick documentation tree.
Please report bugs in RMagick, its documentation, or its installation programs via the bug tracker on the RMagick issues page.
However, We can't help with Ruby installation and configuration or ImageMagick installation and configuration. Information about reporting problems and getting help for ImageMagick is available at the ImageMagick website or the ImageMagick Discussions.
In order to minimize issues on your local machine, we recommend that you make use of Dev Containers. This provides a consistent, pre-configured development environment using Docker.
Steps to get up and running with a passing build are as follows:
To use Dev Containers, you will need to install the following tools on your machine:
Clone the repository to your local machine and open it in VS Code:
git clone https://github.com/rmagick/rmagick.git # or your fork
cd rmagick
code .
Once VS Code opens, it should detect the .devcontainer configuration and prompt you to "Reopen in Container".
During this process, VS Code will ask you to select a devcontainer.json configuration. You can choose the environment you want to develop and test against:
.devcontainer/devcontainer.json) - Recommended for the latest development..devcontainer/ImageMagick6/devcontainer.json) - For testing against the legacy ImageMagick 6 API.Select the one you need, and VS Code will automatically build the corresponding Docker image and start your isolated development environment. This may take a few minutes the first time.
Once the container is running and the ImageMagick setup is complete, open a new terminal inside VS Code. Install the Ruby dependencies and compile the RMagick extension:
$ bundle install
$ bundle exec rake
And you're all set! The codebase on your local machine is automatically synced with the container. You can edit files using your local VS Code, and run tests seamlessly within the integrated container terminal.
Authors: Tim Hunter, Omer Bar-or, Benjamin Thomas
Thanks to ImageMagick Studio LLC for ImageMagick and for hosting the RMagick documentation.
lib/rmagick/version.rbrake again just to be sure.rake release