rmagick

Can't install rmagick, pkg-config: command not found

主宰稳场 提交于 2019-11-29 06:58:38
问题 I'm trying to install rmagick on my Mac OS X v10.9 (Mavericks) machine. However. I get this error /usr/local/bin/Magick-config: line 41: pkg-config: command not found /usr/local/bin/Magick-config: line 47: pkg-config: command not found /usr/local/bin/Magick-config: line 50: pkg-config: command not found /usr/local/bin/Magick-config: line 53: pkg-config: command not found checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes /usr/local/bin/Magick

RMagick - how do I find out the pixel dimension of an image

白昼怎懂夜的黑 提交于 2019-11-29 05:37:58
This may be a stupid question, but how does one find the image width and height in pixels? image.x_resolution and image.y_resolution both return 0 for some reason. require 'rmagick' img = Magick::Image.ping( 'demo.png' ).first width = img.columns height = img.rows Note .ping method imported from comments. If you need to read the image to process it, then use Magick::Image.read( 'demo.png' ).first - the use of ping works in this stand-alone code and speeds processing up for some image types where IM can just read a header block. This is useful for cases where you don't need to load the image

Installing RMagick gem — Can't find MagickWand.h

萝らか妹 提交于 2019-11-29 03:48:50
I am installing the rmagick gem on OSX 10.6.8, using gem install rmagick , and I am getting the following error Can't install RMagick 2.13.1. Can't find MagickWand.h. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users

How to deal with memory leaks in RMagick in Ruby?

寵の児 提交于 2019-11-29 03:32:54
Im developing web-application with Merb and im looking for some safe and stable image processing library. I used to work with Imagick in php, then moved to ruby and start using RMagick. But there is a problem. Long running scripts causing memory leaks. There are couple solution exists, but I don't know which one is the most stable. So, what do you think? Right now, my app uses internal API that i wrote to process images, in PHP. Its running on separate server along with other applications, so its not a big problem. But i think its not a good architecture. Anyway, i`ll consider any practical

RMagick remove white background from image and make it transparent

折月煮酒 提交于 2019-11-28 23:41:07
I need to remove the white background from this image and make the background transparent. So it's just a black tick on the transparent background exported as a png. e.g. Turn Into Any ideas? convert image.png -matte -fill none -fuzz 1% -opaque white result.png Replaces anything white with transparency. The fuzz option includes anything that is almost-white. I know I am pretty late to the party, but a lot has changed since this question was first posted, so here is how you can do it today using at least version 2.15.4 of rmagick Assuming you have the image somewhere accessible: image = Magick:

Properly converting a CMYK image to RGB with RMagick

对着背影说爱祢 提交于 2019-11-28 20:52:10
I have been using the below to do a color conversion if @image.colorspace == Magick::CMYKColorspace # @image.colorspace #=> CMYKColorspace=12 @image.colorspace = Magick::RGBColorspace @image = @image.negate end It works, approximately, but the color luminosity is off. The fact that I need to negate the image leaves a very bad smell. The documentation mentions using color_profiles, but beyond that I can not find much. I am now trying @image = @image.quantize(16777216, Magick::RGBColorspace) And the colors are better, but still off. Thanks Pekka, you tipped me off to the answer (+1). You must

Is it possible to get the average image color with RMagick?

孤街醉人 提交于 2019-11-28 18:26:05
I need to know the average color from an image when I upload it to my Ruby on Rails application. Is it possible to get the average color value in HEX or in RGB to use this color later in the view that's going to display this image? Something like: img = Magick::Image.read(path).first hexVal = img.getHexValue Resize the image to one pixel and get its color? img = Magick::Image.read(path).first pix = img.scale(1, 1) averageColor = pix.pixel_color(0,0) I don't think you can ask an RMagick image for its average color directly but computing such a thing isn't that difficult. I think the easiest way

ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h

别等时光非礼了梦想. 提交于 2019-11-28 16:27:15
问题 I upgraded to imagemagick-7.0.4-3.sierra and now my previously installed RMagck 2.16 fails. I checked for MagicWand: $ find /usr/local -name MagickWand.h /usr/local/Cellar/imagemagick/7.0.4-3/include/ImageMagick-7/MagickWand/MagickWand.h So it seems to be there. Also I reinstalled and relinked pgk-config. Didn't help as well. Any ideas? 回答1: I have just encountered and solved this issue on a new Mac running Sierra. There seems to be no solution for ImageMagick 7 at this time. Uninstall

Bundle can't install RMagick gem on Mac OSX 10.7

我是研究僧i 提交于 2019-11-28 15:51:01
问题 I've installed ImageMagick with ImageMagick installer script https://github.com/maddox/magick-installer. I am on OSX Lion 10.7, using RVM, Ruby 1.9.3p125. The problem seems to be with MagickWand.h here is the complete log /Users/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config. checking for /usr/bin/gcc... yes checking for Magick-config... yes checking for ImageMagick

Error installing Rmagick on Mountain Lion

瘦欲@ 提交于 2019-11-28 15:19:11
I have seen other people with the same issue of installing RMagick on Mountain Lion However none of the suggested solutions have allowed me to successfully install rmagick. Here is the error message I am getting: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. checking for Ruby version >= 1.8.5... yes checking for /usr/local/bin/gcc-4.2... yes checking for Magick-config... yes checking for ImageMagick version >= 6.4.9... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand