10 ms·
Show HN: Ruby-libgd – Native 2D graphics engine for Ruby (no CLI, no JavaScript)
Hi HN,
I built *ruby-libgd*, a native Ruby binding to the libgd graphics library.
The goal is to provide a lightweight, in-process 2D graphics engine for Ruby — not an image manipulation wrapper, but a canvas-based drawing API with deterministic rendering.
Unlike tools like MiniMagick (which wrap ImageMagick CLI), ruby-libgd runs entirely in-process and exposes explicit drawing primitives: lines, shapes, text, fonts, colors, and pixel-level control.
Simple example:
```ruby
img = GD::Image.new(400, 300)
white = GD::Color.rgb(255, 255, 255)
black = GD::Color.rgb(0, 0, 0)
img.rectangle(20, 20, 200, 150, black)
img.text("Hello Ruby", x: 30, y: 40, color: black)
img.save("output.png")
- Borg3 8mo agoSomething like this? http://borg.uu3.net/~borg/?gperf http://borg.uu3.net/~borg/?gperf This stuff is written in Ruby :)
- ggerman2025 8mo agoNot exactly. That link looks like a Ruby-level drawing demo (and I don’t see a public repo or docs behind it). ruby-libgd is a native, in-process binding to libgd, focused on deterministic rendering and explicit pixel-level primitives, released under the MIT license. On top of that, I built libgd-gis (also MIT) as a higher-level standard: map rendering, GeoJSON ingestion, layers, tiles, and reproducible output for GIS-style workloads. ruby-libgd is the low-level graphics engine; libgd-gis is the map renderer built on it.
- Borg3 8mo agoYeah, its private stuff.. I added GRX Lib bindings to Ruby so I can use Ruby to do 2D graphics.. Ive been looking for somethink like this but couldnt find anything usefull for me, so I made one.. Here is example/demo: http://borg.uu3.net/~borg/?grx/test http://borg.uu3.net/~borg/?grx/test gperf is not a demo, it my simple performance counters drawing app.
- ggerman2025 8mo agoThanks for the clarification — that makes sense. My goal with ruby-libgd / libgd-gis is to provide a public, documented, reusable graphics and map-rendering stack for Ruby.