rmagick

Homebrew install package with a particular version

ε祈祈猫儿з 提交于 2019-12-05 10:45:28
Unfortunately on my MAC I am unable to get the gem "rmagick" to install. I've tried pretty much a all the options. I had gotten it to install when I used "imagemagick 6.3.9.7". Therefore, I want to know is there a way to install a particular version of the software using brew ? Something like brew install imagemagick -v 6.3.9.7 Search for available versions with: brew search imagemagick To install a specific version use this forumla: brew install package@<version> , in your case it's: brew install imagemagick@6.3.9.7 来源: https://stackoverflow.com/questions/41800136/homebrew-install-package

Brew linking with ImageMagick

寵の児 提交于 2019-12-05 10:38:58
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 Error: The linking step did not complete successfully The formula built, but is not symlinked into /usr

Can't find Magick-config [duplicate]

邮差的信 提交于 2019-12-05 05:49:57
Possible Duplicate: ImageMagick / RMagick - Can't install RMagick 2.13.1. Can't find Magick-config I am getting the following error when I try to run my dev console (MAC OS X / Snow Leopard). Does anyone know the solution? /usr/local/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... no Can't install RMagick 2.13.1. Can't find Magick-config in .:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary

Resizing Animated GIF images with ruby?

醉酒当歌 提交于 2019-12-05 02:06:51
问题 I am trying to resize a GIF image to different sizes. I am using RMagick library in ruby. But it seems for some gif images the file size increases even when I am downsizing GIF. And I am resizing the image image in same aspect ratio. Here is the my code. require 'rmagick' path = "/path/to/file/" s_image = "image.gif" # image is 320*320 t_image = "t.gif" file_name = path+s_image file = File.new(file_name) list = Magick::ImageList.new.from_blob file.read list = list.coalesce.remap list.each do

How do you generate retina (iPad) friendly (progressive or interlaced) jpeg images with CarrierWave?

依然范特西╮ 提交于 2019-12-05 01:09:43
问题 There are numerous reports that Mobile Safari downsamples very large JPEG images, making it difficult to put out retina-friendly resolutions for the new iPad. The solution seems to be encoding JPEGs as progressive/interlaced files. Hence, I'm curious how I might use the CarrierWave plugin, and RMagick by extension, to generate this type of file. Thanks! 回答1: You can use MiniMagick: manipulate! do |img| img.strip img.combine_options do |c| c.quality "90" c.depth "8" c.interlace "plane" end img

JPG to PNG using RMagick

那年仲夏 提交于 2019-12-05 00:51:46
问题 I'm trying to convert a fetched image from JPG to PNG using RMagick, resize it and then store it on S3: thumb = Magick::Image.read("artist.jpg").first thumb.write("artist.png") thumb.crop_resized!(120, 120, Magick::CenterGravity) AWS::S3::S3Object.store("image.png", thumb.to_blob, AWS_BUCKET, :content_type => 'image/png', :access => :public_read) The image does get saved as a png but when I open it in Preview, document type still says "JPEG image". In fact, the image won't even open in

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

狂风中的少年 提交于 2019-12-04 17:13:48
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 automatically breaking the lines (Word wrap) to fit all the text into my defined area ( 800x600 ). What

Ruby graphic libraries

房东的猫 提交于 2019-12-04 13:16:40
What's the difference between RMagic, ImageMagick, GD, etc. and which one should I use? I was looking for a thumbnail generation script and noticed that every script I found uses a different library for the same thing. Imagemagick, GD, DevIL, and GraphicsMagick are libraries used to create and edit image files. RMagick is a ruby wrapper around ImageMagick/GraphicsMagick. You may find other wrappers I've had luck installing and configuring GraphicsMagick (similar to ImageMagick) and using RMagick on my Mac. Are you doing batch processing? What about logical resizing (fixed X Y, max X Y, percent

Converting PDF to PNG with transparent background

旧街凉风 提交于 2019-12-04 10:22:15
We have a Ruby on Rails application that needs to convert a PDF into a PNG with a transparent background. We're using rmagick 2.13.1. On our development machines the following code works exactly how we want it. pages = Magick::Image.from_blob(book.to_pdf.render){ self.density = 300 } page = pages[0] image_file = Tempfile.new(['preview_image', '.png']) image_file.binmode image_file.write( page.to_blob { |opt| opt.format = "PNG" } ) We thens save the image_file and all is peachy. When we deployed to a review server on Heroku, though, the generated image has a white background. It turns out that

Pixel RGB with ImageMagick and Rails

眉间皱痕 提交于 2019-12-04 03:57:05
问题 I'm currently uploading an image with PaperClip and ImageMagick. I would like to get the image's average color so I'm doing this (with a before_create hook): def get_average_color img = Magick::Image.read(self.url).first pix = img.scale(1, 1) averageColor = pix.pixel_color(0,0) end This works but when I try to print the pixel colors out I get them like this: red=36722, green=44474, blue=40920, opacity=0 How can I get these RGB values into regular (0-255) RGB values. Do I just mod them? Thanks