Bugs: Browse | Submit New | Admin

[#27492] Image is cropped weird. Width parameter is not working.

Date:
2009-11-27 06:41
Priority:
3
Submitted By:
Volkan Unsal (picardo)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Image is cropped weird. Width parameter is not working.

Detailed description
I am using the following code snippet to output a database generate graphic.


myproducts = Product.find(:all)

require 'rmagick'
require 'scruffy'

graph = Scruffy::Graph.new
graph.title = "Comparison of Product Sales"

stores=Store.find(:all, :select=>"id, location")

myproducts.each do |product|
  counts=stores.collect do |store|
    Purchase.count("id", :conditions=>{
      :store_id=>store.id,
      :product_id=>product.id
    })
  end
  graph.add :line, product.name, counts
end
graph.point_markers=stores.map{|store| store.location}
graph.render :as=>'png', :to=>'productsales.png', 
:width=>900, :theme=>Scruffy::Themes::Keynote.new

The outcome I expect from this is an image 900px wide. But I get instead a 540px wide image and the height is fixed
at 200px. I tried different values for width but could not get the height to budge, and it always comes looking cropped.
See the attached image.

I'm not sure if it matters but I am using Windows 7. 

Add A Comment: Notepad

Please login


Followup

Message
Date: 2011-03-26 13:09
Sender: John Ferguson

See defect 27961 - same issue on OS/X but with a work around
if edit base.rb in the installed gem.  On OS/x this worked for
me.  There was some hard coded limit put on the rendering space
so - yes your parameters were being "sort of ignored".

I am not a dev on this project.  However, if this problem and
my post go unanswered I may be asked to be at least allowed to
apply the suggested fix.

Attached Files:

Name Description Download
productsales.png Download

Changes:

Field Old Value Date By
File Added4809: productsales.png2009-11-27 06:41picardo