gd-icon-renderer
Version, currently main branch1 version
- main branchlatestJan 21, 2024
github.com/oatmealine/gd-icon-renderer
A Crystal Geometry Dash icon renderer library
Installation
# Add this to your shard.yml
dependencies:
gd-icon-renderer:
github: oatmealine/gd-icon-renderer
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
1.6.2- License
- MIT
- Author
- Jill "oatmealine" Monoids
- Target
gd-icon-rendererfrom src/gd-icon-renderer-cli.cr
Dependencies
Runtime Dependencies
- vips*github: naqvis/crystal-vips, branch: main
README
gd-icon-renderer
A (WIP) Crystal Geometry Dash icon renderer library, utilizing libvips
Why?
Server-side rendering of icons. This functionality doesn't need to be restricted to an HTTP server, so I figured I could just move it into a library.
Pre-requisites
You'll need to install libvips, alongside a devel package for building if available. Be sure to leave this note in the README of the application you're making too.
Installation
-
Add the dependency to your
shard.yml:dependencies: gd-icon-renderer: github: oatmealine/gd-icon-renderer -
Run
shards install
Usage
Currently, for most examples under examples/, you'll have to plug the icons folder of your GD install in data/. Otherwise, the process for rendering an icon is as follows:
-
Load spritesheets:
# Replace the filepaths here with whatever is relevant for your usecase sheet = IconRenderer::Assets.load_spritesheet("data/icons/ship_44-uhd.plist") -
Render the icon out:
icon_img = IconRenderer::Renderer.render_icon("ship_44", [0.0, 0.0, 0.0, 1.0], [255/255, 125/255, 125/255, 1.0], nil, true, sheet)You'll now be given a
Vips::Image. -
(Optional) You might find it useful to now trim the whitespace out, as Geometry Dash icons usually have lots of surrounding blank space:
alpha = icon_img.extract_band(3) left, top, width, height = alpha.find_trim(threshold: 0, background: [0]) icon_img = icon_img.crop(left, top, width, height) -
You'll most likely want to save the resulting image somewhere:
icon_img.write_to_file("icon_rendered.png")
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jan 21, 2024
- Crystal
1.6.2- Indexed
- yes
Dependents
Repository
github.com/oatmealine/gd-icon-renderer
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1