rmagick

Caching dynamic images in Rails

I am using the rmagick gem for generating dynamic images from a controller. The controller takes an id as a param, does a look up on a model, writes text over an existing image, and outputs it. I have run some benchmarks comparing generating it for every request versus writing to disk and using send_data to output it if it already exist...

Properly converting a CMYK image to RGB with RMagick

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...

Can't get gravity to work with RMagick and 'caption'

I'm using RMagick 2.12.2 with ImageMagick 6.5.6-10 on Snow Leopard. I'm trying to put captions on a collection of photos, and I'm getting the caption to work (i.e. it appears on the image), but I can't get the gravity parameter to work correctly. No matter what I set it to, I end up with some variation on NorthGravity. For instance: Se...

RMagick filesize giving strange output for different sized images

When the snippet below surprisingly giving the same output for the original and the resized image. Executed with rmagick (2.12.2) and ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] on Ubuntu Jaunty. img = nil File.open("~/rmagick/test/original.JPG", "r") { |f| img = f.read } img = Magick::Image::from_blob(img).first p img.filesize #...

rmagick or other library for producing 3D pie chart

I am interested in making a 3D pie chart dynamically on my page depending on values pulled from my database. The chart would only be updated every few days, so I don't mind a process intensive task as I could cache the image. 2D charts and pie graph libraries seem to be everywhere, but are there any libraries (server side image magic, or...

Trying to install Rmagick on Debian

One of things you need to do to get Rmagick installed apt-get install libmagick9-dev When I try that I get the following errors Reading package lists... Done Building dependency tree... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distributio...

RVM Ruby 1.8.6 problem with RMagick

I have Mac OS X 10.6.2 with default Ruby 1.8.7. I installed Ruby 1.8.6 thourgh RVM (rvm install 1.8.6). While I run my tests with Ruby 1.8.6 I get error: dyld: NSLinkModule() error dyld: Symbol not found: _DestroyConstitute Referenced from: /Users/snowak/.rvm/gems/ruby-1.8.6-p383/gems/rmagick-2.12.2/lib/RMagick2.bundle Expected in: ...

RMagick freezes ruby processes when required on OS X Snow Leopard

I've got quite a strange problem. I've installed ImageMagick via homebrew. I've installed rmagick-2.12.2 and rmagick-2.11.2 with no issues. I get no errors on installation of either. ImageMagick seems to be installed and in my path: $ convert --version Version: ImageMagick 6.5.6-5 2010-01-30 Q16 OpenMP http://www.imagemagick.org Cop...

Calculate thumbnail sizes with RMagick

I'm using attachment_fu and RMagick to upload/resize images on a rails app. Currently I use the local file system as the storage but I have a plan to use AWS S3 for the job. Anyway I am quite interested to know what other peoples' experiences on using S3 and also I have a one big question for you. In my app when a user uploads an image I...

How to find the path to ImageMagick config files

I'm attempting to load a ICM color profile file that is stored with the main ImageMagick config files (colors.xml, etc.) using RMagick. I want to make sure that I always provide the correct path to the file across deployments using slightly different ImageMagick setups and/or versions. Is there a way to find to get this location from Im...

Getting rmagick to work with Phusion Passenger

I'm trying to deploy my app using Phusion Passenger on DreamHost and I'm very close ... I've unpacked my gems [ecco]$ rake gems (in /home/myuser/myurl.com/trunk) - [F] authlogic - [R] activesupport - [F] cancan - [F] formtastic - [R] activesupport >= 2.3.0 - [R] actionpack >= 2.3.0 - [F] paperclip - [F] rmagick - [F]...

How to serve generated images with sinatra in ruby

I wrote a simple Sinatra app that generate an image using rmagick from some user inputs. The image is saved in the ./public directory with a unique file name. The unique file name is used in the HTML generated by Sinatra so that each user gets the correct image. Once a day a script deletes files older than one hour. This is clearly a ter...

RMAGICK: resizing and changing the filetype of pictures (on the fly)... Improper Image Header Error

Hi, it's about RMagick with Ruby On Rails. I do the following: image = params[:image] # params[:image] is the image from the file-form. name = image.original_filename.scan(/[^\/\\]+/).last name = dir + t.day.to_s + t.month.to_s + t.year.to_s + t.hour.to_s + t.min.to_s + t.sec.to_s + name f = File.new(name, "wb") f.write im...

rmagick: doing the polaroid effect, changing the pictures caption

Hi, it's about rMagick and the polaroid effect. image = image.polaroid do self.font = "Tahoma" self.caption = name #self[:caption] = name self.shadow_color = "gray40" self.pointsize = 12 end This is how I tried to change it's caption, but both versions don't work. Any ideas? Yours Joern. ...

RMagick returns nil reading JPEG

When I try to open a JPEG format file in Rails using RMagick, it always return nil with any jpg file. Other file formats open well. $ script/console Loading development environment (Rails 2.3.4) >> require 'RMagick' >> img = Image.read("1.gif").first => 1.gif GIF 230x100 230x100+0+0 PseudoClass 256c 8-bit 2kb >> img = Image.read("1.png"...

Rmagick, Watermarks, and Image Transparency

I'm having trouble making an image semi-transparent. I have one image I'd like to set to 50% opacity and position it over another image(using composite operator:OverCompositeOp). Anyone know how an easy way to do such a thing? A little background: I'm trying to make a good watermark to place over images, but I'm not fan of rmagick's bu...

RMagick + Rails + Heroku?

I'm trying to figure out how to get rmagick on my app, and then make it work on Heroku? ...

RMagic Error in rails, with AM Charts

Hi Everyone, I'm using AMCharts and rails. AMCharts uses the Image Magic lib to export an image of the chart. In rails this is done with the gem, RMagic. In a controller this is implemented with the following controller method: def export width = params[:width].to_i height = params[:height].to_i data = {} img = Magic...

Splitting PDF to png

I'm using paperclip to upload a pdf. Once the file is uploaded I need to split every page into a png. This is the command I think I need to use convert -size 640x300 fileName.pdf slide.png Now if I run that command from terminal it works fine, but I need a way of getting each slides name so I can add it into a model. What's the best w...

Imagemagick - File Naming

I am using the convert command to convert a pdf to multiple pngs, I need the naming conventions to be slide-##.png at the moment they come out like slide-1.png but because there is 20+ slides when I loop through them to add them into the model the order comes up wrong, so it looks like slide-1.png slide-10.png slide-11.png and so on, how...