Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

##Perl + GD, 146 chars

Perl + GD, 146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

##Perl + GD, 146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

Perl + GD, 146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

##Perl + GD, 146 chars

Per the comments to my other answer other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

##Perl + GD, 146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

##Perl + GD, 146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

shorten to 146 chars
Source Link
Ilmari Karonen
  • 21k
  • 5
  • 55
  • 101

##Perl + GD, 166146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;@c=GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2;($m=GD'Simple->new(70,12))->move(2,12x2);$m->fgcolor(@c[$i+8[$i+8,$i+4,$i++]),$m->string($_)for split/$i++];string$m$&/,"Hello World";print$meg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

##Perl + GD, 166 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;@c=((0)x5,127,(255)x5,127)x2;($m=GD'Simple->new(70,12))->move(2,12);$m->fgcolor(@c[$i+8,$i+4,$i++]),$m->string($_)for split//,"Hello World";print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

##Perl + GD, 146 chars

Per the comments to my other answer, here's a solution that directly produces an image file using the GD library:

use GD'Simple;move{$m=new GD'Simple 70,12}2,12;s//Hello World/;s/./fgcolor$m(((0)x5,127,(255)x5,127)x2)[$i+8,$i+4,$i++];string$m$&/eg;print$m->png

And here's the output:

Hello World

Again, using a black background would look better, but would cost me 29 characters ($m->bgcolor(0,0,0);$m->clear;).

Edit: Figured out how to shave off 20 chars by (ab)using indirect object notation and a few other tweaks. The new code emits a warning, but still runs fine.

deleted 2 characters in body
Source Link
Ilmari Karonen
  • 21k
  • 5
  • 55
  • 101
Loading
Source Link
Ilmari Karonen
  • 21k
  • 5
  • 55
  • 101
Loading

AltStyle によって変換されたページ (->オリジナル) /