# coding=UTF-8
from visual import *
# 球を作成
pyramid1 = pyramid(pos=(0, 0, 0), size=(1,1,1),
color=(0x99/255.,0xdd/255.,0xff/255.))
# 回転
pyramid1.rotate(angle=pi*90./180., axis=(1,0,1))
出力画面
動作環境
Python 3.1.3, VPython 5.41
import javax.imageio.*
import net.coobird.thumbnailator.*
Thumbnails.of(new File("SF.JPG"))
.size(150, 150)
.watermark(Positions.BOTTOM_RIGHT,
ImageIO.read(new File("yourlogo.png")),
0.7f)
.toFile(new File("SF_WATERMARK.JPG"))
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja"
xml:lang="ja" dir="ltr">
<head>
<title>gd_test3</title>
</head>
<body>
<?php
$sx = 200;
$sy = 200;
$img = imagecreatetruecolor($sx, $sy);
imagesavealpha($img, true);
imagealphablending($img, false);
// 半透明グラデーションを作成
$c1 = 0x007799dd;
$c2 = 0x80ffffff;
for($ly=0;$ly<$sy;$ly++){
$a1 = ($c1 >> 24) & 0xff;
$r1 = ($c1 >> 16) & 0xff;
$g1 = ($c1 >> 8 ) & 0xff;
$b1 = $c1 & 0xff;
$a2 = ($c2 >> 24) & 0xff;
$r2 = ($c2 >> 16) & 0xff;
$g2 = ($c2 >> 8 ) & 0xff;
$b2 = $c2 & 0xff;
$ao = $a1 + round(($a2 - $a1)/$sy*$ly);
$ro = $r1 + round(($r2 - $r1)/$sy*$ly);
$go = $g1 + round(($g2 - $g1)/$sy*$ly);
$bo = $b1 + round(($b2 - $b1)/$sy*$ly);
for($lx=0;$lx<$sx;$lx++){
imagesetpixel($img, $lx, $ly,
imagecolorresolvealpha($img, $ro, $go, $bo, $ao));
}
}
// ファイル出力
imagepng($img, "gd_test3.png", 0);
// 開放
imagedestroy($img);
?>
<img src="gd_test3.png" /><br />
</body>
</html>