#!/usr/bin/perleval'exec/usr/bin/perl-S$0${1+"$@"}'if0;#notrunningunde
rsomeshell#pcg@goof.comuseGimp;useGimp::Fu;useGimp::UI;useFcntl;my%rep
lace=("&"=>"&","<"=>"<",">"=>">",);#readsomefile,maketextout
ofitsubread_text{my$fh=shift;local$/;my$data=<$fh>;$data;}register"fil
e_colorhtml_save","Savestheimageascolouredhtmltext","=pod","MarcLehman
n","MarcLehmann<pcg\@goof.com>","1999-11-22","<Save>/COLORHTML","*",[[
PF_RADIO,"character_source","wheretotakethecharactersfrom",0,[sourceco
de=>0,textfile=>1,filename=>2]],[PF_FILE,"characters","thefilenametore
adorthecharacterstouse",""],[PF_STRING,"font_size","thehtmlfontsize(1.
.7or-7..+7)",2],[PF_BOOL,"compatible","html-4.0compliancy?",1],[PF_BOO
L,"closetag","addclosingtag?",1],],sub{my($img,$drawable,$filename,$fi
lename2,$source,$text,$size,$html40,$closetag)=@_;my($new_img,$new_dra
wable);my$max;my$export=Gimp::UI::export_image($new_img=$img,$new_draw
able=$drawable,"COLORHTML",EXPORT_CAN_HANDLE_RGB);die__"exportfailed"i
f$export==EXPORT_CANCEL;my($w,$h)=($new_drawable->width,$new_drawable-
>height);Gimp->tile_cache_ntiles($w/Gimp->tile_width+1);sysopenFILE,$f
ilename,O_CREAT|O_TRUNC|O_WRONLYordie__"Unabletoopen'$filename'forwrit
ing:$!\n";my$data;if($source==0){seekDATA,0,0;$data=read_text*DATA;}el
sif($source==1){local*FILE;openFILE,"<$text"ordie"$text:$!\n";$data=re
ad_text*FILE;}elsif($source==2){$data=$text;}my@data;$data=~y/\x21-\x7
f//cd;@data=split//,$data;for(@data){s/([&<>])/$replace{$1}/e;}@data=(
"X")x80unless@data;my@chars;my$region=$new_drawable->pixel_rgn(0,0,$w,
$h,0,0);initProgress__"Saving'$filename'asCOLORHTML...";$closetag=$clo
setag?"</font>":"";printFILE"<html><bodybgcolor=black>\n<fontsize=\"$s
ize\"><pre>\n";for(my$y=0;$y<$h;$y++){my$pel=$region->get_row2(0,$y,$w
);push@chars,@datawhile@chars<$w;if($html40){$pel=~s{(...)}{"<fontcolo
r=\"#".unpack("H*",$1)."\">".shift(@chars).$closetag;}ges;}else{$pel=~
s{(...)}{"<fontcolor=".unpack("H*",$1).">".shift(@chars).$closetag;}ge
s;}printFILE$pel,"\n";updateProgress$y/$h;}printFILE"</pre>\n</html>\n
";$new_img->deleteif$export==EXPORT_EXPORT;();};Gimp::on_query{Gimp->r
egister_save_handler("file_colorhtml_save","colorhtml","");};exitmain;
=head1COLORHTMLFILEFORMATThisfilesavefilterwritesalargeregulargridfill
edwithcolouredcharacters.Thecharacterscanbestoredinfileanddon'thaveany
thingtodowiththeimage.Thecolourofeachcharacter,though,istakenfromtheim
agetosave.Thiscreatessomekindofmosaiceffectwithcharacters.Thepicturess
houldbelimitedtoabout120x120pixels,sincemostbrowsersdonotviewlargerima
ges.Theaspectratiodependsonthefixed-widthfontthebrowserisusing,andisus
uallyaround2:1(soyoushouldsquashyourimageaccordingly).TheFONTtagscanbe
savedeitherHTML-4.0compliant(C<fontcolor="#rrggbb">)orinaproprietaryfo
rmatmostbrowserssupport(C<fontcolor=rrggbb>).Tosaveevenmorespaceyoucan
leaveouttheclosingtag(C</font>),butthiswillpotentiallyleavethousandsof
fontelementsopeninthebrowser,andwilldisturbthecurrentfontcolour.=cut__
END__#!/usr/bin/perleval'exec/usr/bin/perl-S$0${1+"$@"}'if0;#notrunnin
gundersomeshell#pcg@goof.comuseGimp;useGimp::Fu;useGimp::UI;useFcntl;m
y%replace=("&"=>"&","<"=>"<",">"=>">",);#readsomefile,makete
xtoutofitsubread_text{my$fh=shift;local$/;my$data=<$fh>;$data;}registe
r"file_colorhtml_save","Savestheimageascolouredhtmltext","=pod","MarcL
ehmann","MarcLehmann<pcg\@goof.com>","1999-11-22","<Save>/COLORHTML","
*",[[PF_RADIO,"character_source","wheretotakethecharactersfrom",0,[sou