|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
|||||||||||||||||||||||||||||||||||||||||||||||
2024年02月09日(金) 旧暦 [n年日記] [更新:"2024/02/09 07:53:08"]#1 [DWL66+][377nm] bit map format for contrast curve
Download (for Save Link As)
![]()
#!/usr/pkg/bin/perl
use strict;
my($VERSION);
$VERSION = "2024-02-10 08:32" ; # written by emacs time-stamp
## $VERSION .= ' UTC';
$VERSION =~ s/ /-/g;
$VERSION =~ s/:/./g;
sub box {
my ($arg_ptr) = @_;
my $width = $arg_ptr -> { -width};
my $length = $arg_ptr -> { -length};
my $value = $arg_ptr -> { -value};
my $gap = $arg_ptr -> { -gap};
foreach my $i (0..$length - 1) {
foreach my $j (0..$width - 1) { print PGM $value . ' ' ; }
foreach my $g (0..$gap-1 ) { print PGM '00 ' ; }
foreach my $j (0..$width - 1) { print PGM $value . ' ' ; }
print PGM "\n";
}
}
sub main() {
my $base_name = $0;
$base_name .= '-'. $VERSION;
my $pgm_name .= $base_name . '.pgm';
my $bmp_name .= $base_name . '.bmp';
open(PGM, "> $pgm_name") || die "problem opening file to write: $!\n";
print $pgm_name,"\n"; # See below after __END__ line
my $max = 127;
my $width = 100;
my $length = 50;
my $gap = 25;
my $totalW = $width * 2 + $gap;
my $totalH = $length * 4 + $max * 2;
print PGM "P2\n";
printf( PGM " # %2d x %d bitmap PGM format\n", $totalW, $totalH);
print PGM $totalW, ' ' . $totalH . "\n";
print PGM $max . "\n";
box ({ -length => $length, -width => $width, -value => $max, -gap=> $gap});
box ({ -length => $length, -width => $width, -value => 0 , -gap=> $gap});
foreach my $value (0..$max - 1) {
foreach my $repeat (0,1) {
foreach my $j (0..$width - 1) { print PGM $value . ' ' ; }
foreach my $g (0..$gap - 1) { print PGM '00 ' ; }
foreach my $j (0..$width - 1) { print PGM $max - $value . ' ' ; }
}
print PGM "\n";
}
box ({ -length => $length, -width => $width, -value => 0 , -gap=> $gap});
box ({ -length => $length, -width => $width, -value => $max, -gap=> $gap});
system ("convert $pgm_name $bmp_name") && die "conversion problem: $!\n";
}
main();
__END__
feh `perl 225x456`
; please note I have copy in ~/.emacs-sub/time-stamp-setup.el
(require 'time-stamp)
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-active t)
;; (setq time-stamp-time-zone "UTC")
(setq time-stamp-time-zone nil)
(setq time-stamp-format "%04y-%02m-%02d %02H:%02M");
(setq time-stamp-start "$VERSION = \"") ;
(setq time-stamp-end "\"") ;
(setq time-stamp-line-limit 20) ; ; default is 8
( Post message... )
|
最近の日記 2024年11月14日 ・DWL66+ 2018 405 nm 2024年02月19日 ・another (large, 0.55 x 1.0 m/m) version for contrast curve 2024年02月15日 ・curved star cone 2024年02月13日 ・paraboloid with base plane 2024年02月09日 ・bit map format for contrast curve | ||