# Scruffy is outputting 4x2 blank images

**URL:** <https://www.ruby-forum.com/t/scruffy-is-outputting-4x2-blank-images/174310>\
**Category:** Ruby\
**Created:** [August 24, 2009, 9:04pm UTC](https://www.ruby-forum.com/t/scruffy-is-outputting-4x2-blank-images/174310 "2009-08-24T21:04:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![den1jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@den1jay](https://www.ruby-forum.com/u/den1jay)\
**Post date:** [August 24, 2009, 9:04pm UTC](https://www.ruby-forum.com/t/scruffy-is-outputting-4x2-blank-images/174310/1 "2009-08-24T21:04:05Z")

</div>

I’m having some difficult getting Scruffy to render properly. I don’t  
seem to have any gem issues, and the example code:

require ‘rubygems’  
require ‘scruffy’

graph = Scruffy::Graph.new  
graph.title = “Comparative Agent Performance”  
graph.value\_formatter = Scruffy::Formatters::Percentage.new(:precision  
=\> 0)  
graph.add :stacked do |stacked|  
stacked.add :bar, ‘Jack’, [30, 60, 49, 29, 100, 120]  
stacked.add :bar, ‘Jill’, [120, 240, 0, 100, 140, 20]  
stacked.add :bar, ‘Hill’, [10, 10, 90, 20, 40,10]  
end  
graph.point\_markers = [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’]

graph.render(:width =\> 800, :to =\> ‘test.jpg’, :as =\> ‘JPG’)

runs without error. But test.jpg ends up as a 325 byte file:

test.jpg JPEG 4x2 4x2+0+0 8-bit DirectClass 325b

I’ve tried other Scruffy examples and the same thing happens.

Gruff renders fine, and a simple RMagick example worked as well. I’ve  
upgraded my ImageMagick installation, tried the example script with  
ruby19 but nothing has worked so far.

Is there something I’m missing here? Is this a known issue? I’m not  
really sure where to look next.

---

<div class="post-metadata">

**Author:** ![den1jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@den1jay](https://www.ruby-forum.com/u/den1jay)\
**Post date:** [August 25, 2009, 1:59pm UTC](https://www.ruby-forum.com/t/scruffy-is-outputting-4x2-blank-images/174310/2 "2009-08-25T13:59:36Z")

</div>

Jay Mendoza wrote:

> Gruff renders fine, and a simple RMagick example worked as well. I’ve  
> upgraded my ImageMagick installation, tried the example script with  
> ruby19 but nothing has worked so far.

Whoa. Does your code work in ruby 1.8.x?

---

<div class="post-metadata">

**Author:** ![den1jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@den1jay](https://www.ruby-forum.com/u/den1jay)\
**Post date:** [September 14, 2009, 8:18pm UTC](https://www.ruby-forum.com/t/scruffy-is-outputting-4x2-blank-images/174310/3 "2009-09-14T20:18:47Z")

</div>

On Aug 25, 7:59 am, 7stud – [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Jay Mendoza wrote:
> 
> > Gruff renders fine, and a simple RMagick example worked as well. I’ve  
> > upgraded my ImageMagick installation, tried the example script with  
> > ruby19 but nothing has worked so far.
> 
> Whoa. Does your code work in ruby 1.8.x?
> 
> –  
> Posted viahttp://www.ruby-forum.com/.

I was having the same problem. The issue is a “viewPort” declaration  
in renderers/base.rb

The patch is to change line 35 to

svg.svg(:xmlns =\> “[http://www.w3.org/2000/svg](http://www.w3.org/2000/svg)”, ‘xmlns:xlink’ =\>  
“[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)”,  
:viewBox =\> “0 0 #{options[:size].first} #{options[:size].last}”)

See my discussion on

[http://rubyforge.org/tracker/index.php?func=detail&aid=27102&group\_id=2030&atid=7929](http://rubyforge.org/tracker/index.php?func=detail&aid=27102&group_id=2030&atid=7929)

---

<div class="post-metadata">

**Author:** ![den1jay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@den1jay](https://www.ruby-forum.com/u/den1jay)\
**Post date:** [September 14, 2009, 8:30pm UTC](https://www.ruby-forum.com/t/scruffy-is-outputting-4x2-blank-images/174310/4 "2009-09-14T20:30:54Z")

</div>

Stephen Edwards wrote:

> I was having the same problem. The issue is a “viewPort” declaration  
> in renderers/base.rb
> 
> The patch is to change line 35 to
> 
> svg.svg(:xmlns =\> “[http://www.w3.org/2000/svg](http://www.w3.org/2000/svg)”, ‘xmlns:xlink’ =\>  
> “[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)”,  
> :viewBox =\> “0 0 #{options[:size].first} #{options[:size].last}”)
> 
> See my discussion on
> 
> [http://rubyforge.org/tracker/index.php?func=detail&aid=27102&group\_id=2030&atid=7929](http://rubyforge.org/tracker/index.php?func=detail&aid=27102&group_id=2030&atid=7929)

Ah, interesting.

I have since moved on to a flash solution, but this is good to know. I  
appreciate your response.
