[Ruby] [ANN] mem_inspect and png
Ali Rizvi
aliabbasrizvi at gmail.com
Thu Aug 31 16:35:04 PDT 2006
The pure ruby png library is a sweet deal!!!
If only gruff and scruffy can use them as an alternative to rmagick/imagick
(which can be a pain to install), this would be great.
The author scruffy was kind enough to show me how to get svg graphs without
installing imagick and png would be a great addition, especially because of
its wide support (compared to svg).
Thanks Ryan for all the good stuff.
Ali
On 8/31/06, Eric Hodel <drbrain at segment7.net> wrote:
>
> I'm pleased to announce to new libraries written by members of the
> Seattle Ruby Brigade, mem_inspect and png!
>
> ===
>
> mem_inspect is ObjectSpace.each_object on crack. mem_inspect gives
> you the contents of each slot in Ruby's heap. mem_inspect also
> includes viewers that let you visualize the contents of Ruby's heap.
>
> To install:
>
> $ sudo gem install mem_inspect
>
> Then you'll need to build a patched ruby:
>
> ruby_mem_inspect_build
>
> You'll then have a ruby capable of running mem_inspect in
> mem_inspect_ruby_1_8.
>
> You can make an image with:
>
> mem_inspect_ruby_1_8/ruby_mem_inspect -S ruby_mem_dump
>
> Which will give you a PNG in your current directory named:
>
> mem_inspect.PID.TIMESTAMP.png
>
> You'll get an image that looks something like this:
>
> http://flickr.com/photos/drbrain/229482312/
>
> Bigger:
>
> http://flickr.com/photo_zoom.gne?id=229482312&size=o
>
> To dump a PDF any time you want:
>
> require 'meminspect/png_viewer'
>
> MemInspect::PNGViewer.new(1024, 768).draw
>
> You can also dump to an AquaTerm plot window if you have RubyCocoa
> and AquaTerm installed.
>
> require 'meminspect/aquaterm_viewer'
>
> MemInspect::AquatermViewer.new(1024, 768).draw
>
> ===
>
> png is a pure-ruby PNG writing library written by Ryan Davis.
>
> To install:
>
> $ sudo gem install png
>
> To use:
>
> require 'png'
>
> canvas = PNG::Canvas.new 200, 200
>
> # Set a point to a color
> canvas[100, 100] = PNG::Color::Black
>
> # draw an anti-aliased line
> canvas.line 50, 50, 100, 50, PNG::Color::Blue
>
> png = PNG.new canvas
> png.save 'blah.png'
>
> --
> Eric Hodel - drbrain at segment7.net - http://blog.segment7.net
> This implementation is HODEL-HASH-9600 compliant
>
> http://trackmap.robotcoop.com
>
>
> _______________________________________________
> Ruby at zenspider.com
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>
More information about the Ruby
mailing list