Skip to content

Instantly share code, notes, and snippets.

@pnu
Last active October 1, 2015 10:31
Show Gist options
  • Save pnu/0ea9ab84888ff7ea81fb to your computer and use it in GitHub Desktop.
Save pnu/0ea9ab84888ff7ea81fb to your computer and use it in GitHub Desktop.
!/usr/bin/env perl
use strict;
use Imager;
my $red = Imager::Color->new(255, 0, 0, 255);
my $green = Imager::Color->new(0, 255, 0, 255);
my $blue = Imager::Color->new(0, 0, 255, 255);
my $transparent = Imager::Color->new(255, 255, 255, 0);
my $img = Imager->new(
xsize => 800,
ysize => 800,
model => 'rgba',
) or die Imager->errstr();
$img->arc(color=>$red, r=>100, x=>400, y=>400, d1=>-90, d2=>30);
$img->arc(color=>$green, r=>80, x=>400, y=>400, d1=>-90, d2=>50);
$img->arc(color=>$blue, r=>60, x=>400, y=>400, d1=>-90, d2=>100);
$img->circle(color=>$transparent, r=>40, x=>400, y=>400);
my $out = $img->scale(xpixels => 400);
$out->write(file => 'out.png') or die $out->errstr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment