rmagick

Checking if a color is in a specific range of colors

和自甴很熟 提交于 2019-12-08 08:17:34
问题 How would you check if a rgb or hex value is within a specific range of colors? Preferably with ruby. I'm using ruby and rmagick to extract colors (quantize and color_histogram) from images and then store those colors in the database. If someone searched for a color(hex or rgb) that is similar I want to be able to return that color. e.g. If someone searched for #f4f4f4 I'd like to return #f5f5f5, #f3f3f3, and all the other close hex values. 回答1: If you treat RGB as a three-dimensional space

Reading pdfs with RMagick from https gives a not authorized error

。_饼干妹妹 提交于 2019-12-08 02:04:19
问题 I am trying to read a pdf and save the first page as an image. This method works for http, but it doesn't work for https. require 'RMagick' url = "http://www.ke.tu-darmstadt.de/publications/reports/tud-ke-2008-07.pdf" image = Magick::Image.read(url + "[0]") => [http://www.ke.tu-darmstadt.de/publications/reports/tud-ke-2008-07.pdf[0]=>tud-ke-2008-07.pdf PDF 595x842 595x842+0+0 DirectClass 16-bit 27kb] url = "https://www.cs.purdue.edu/homes/dgleich/publications/Gleich%202003%20-%20Machine

Reading pdfs with RMagick from https gives a unable to open file error

最后都变了- 提交于 2019-12-08 01:01:05
问题 I am trying to read a pdf and save the first page as an image. This method works for http, but it doesn't work for https. I recently posted another related question here: Reading pdfs with RMagick from https gives a not authorized error I removed the https line from policy.xml, which got me past the not authorized error. However, a new error happens specific to https: require 'RMagick' url = "http://www.ke.tu-darmstadt.de/publications/reports/tud-ke-2008-07.pdf" image = Magick::Image.read(url

linux CLI: how to render Arabic text into bitmap

a 夏天 提交于 2019-12-07 18:26:31
问题 I would like to draw Arabic text into bitmap (bmp or png) with command line interface. I have tried imagemagick and RMagick, but I have problem with RTL language issue. all my rendering are left to right. And google is not helping. require: ./render "لوحة المفاتيح" out.png would give a bitmap: لوحة المفاتيح Anyone can give me some successful results? 回答1: Anyone can give me some successful results? I can. I use convert from ImageMagick: echo لوحة المفاتيح > text.txt && \ convert -size 300x200

How To Write Custom Metadata to an Image Created by RMagick?

和自甴很熟 提交于 2019-12-07 17:12:12
问题 I'm creating composite images using Rmagick and want to include some specific info (author etc.) in the image file metadata, but can't find an obvious way to do this in the Rmagick docs, can this be done? Sorry if this is an obvious one, but I've been searching around on both the Rmagick docs and here, but have only found a couple of items about orientation on SO, nothing about writing to metadata. From the Rmagick Docs; Annotate seems to write the info on the image, which isn't what I want

Problems installing RMagick with Paperclip in Rails 3

不羁的心 提交于 2019-12-07 15:13:18
问题 I'm trying to use paperclip in rails and when I'm doing the "bundle install" I'm getting the following error: Can't install RMagick 2.13.1. Can't find Magick-config in /usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Users/seanhinton/.rvm/bin What I'm wondering is how do I install RMagick (is that what I need?) on my machine (it's OSX 10.6)? Cheers! 回答1: RMagick is a ruby adapter for ImageMagick. Getting

why is the behavior of extent (imagemagick) not uniform across my machines?

纵饮孤独 提交于 2019-12-07 12:40:13
问题 I'm using extent in rmagick/imagemagick to center images on a canvas of certain size. On some of my machines, it centers them - on others it does the opposite. If I fix code to work on one machine, it does the exact opposite on the other. Does anyone know why this is happening? 回答1: I actually already knew the answer -- after 5 hours of struggling with code. Just posting this for reference. For some unknown (and I think stupid) reason , this appeared in the ImageMagick changelog: 2010-09-13 6

ImageMagick multiline text and background image

亡梦爱人 提交于 2019-12-07 08:00:39
问题 I'm learning to use ImageMagick, but I'm having trouble when I try to generate an image like the example below: And for that, I'm using the following code: convert original.jpg -size 460x caption:'This is a multiline caption, This is a multiline caption, This is a multiline caption.' result.jpg This command generated two separate images, one with just the title. Can you help me? PS: I'm using RubyOnRails with ImageMagick, but you can suggest examples with MiniMagick or Rmagick. Thanks. 回答1:

Brew linking with ImageMagick

梦想的初衷 提交于 2019-12-07 06:51:56
问题 Installing: ostaptan:~ ostap$ brew install imagemagick --disable-openmp --from-source ==> Downloading http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.7-6.tar.bz2 Already downloaded: /Library/Caches/Homebrew/imagemagick-6.7.7-6.tar.bz2 ==> Patching patching file configure Hunk #1 succeeded at 32371 (offset 447 lines). ==> ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.7-6 --enable-shared --disable-static ==> make install

How to render text on image with RMagick and Word wrap?

六月ゝ 毕业季﹏ 提交于 2019-12-06 09:58:23
问题 I need to render some text (unicode, helvetica, white, 22px, bold) on a image (1024x768). This is my code so far: img = Magick::ImageList.new("my_bg_img.jpg") txt = Magick::Draw.new img.annotate(txt, 800, 600, 0, 0, "my super long text that needs to be auto line breaked and cropped") { txt.gravity = Magick::NorthGravity txt.pointsize = 22 txt.fill = "#ffffff" txt.font_family = 'helvetica' txt.font_weight = Magick::BoldWeight } img.format = "jpeg" return img.to_blob Its all fine but its not