This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ref) http://dsas.blog.klab.org/archives/52123322.html | |
class Exif { | |
private $data; | |
private $byteOrder; // 1:Big Endian, 2:Little Endian | |
private $IFDs = array(); | |
private $cursol = 0; | |
const IFD_OFFSET_BASE = 6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cramp255($v) { | |
if ($v < 0) { | |
return 0; | |
} | |
return ($v<=255)?$v:255; | |
} | |
function getRGBA($x, $y, $width, $height) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("memory_limit", '2G'); | |
$nPixels = pow(2, 4 + 4 + 4); | |
$width = (int) sqrt($nPixels); | |
$height = $nPixels /$width; | |
$im = imagecreatetruecolor($width, $height); | |
if (! $im) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title> Image Drop Sample </title> | |
<style> | |
body { background-color: #eff; } | |
canvas { border: 2px solid #888; } | |
</style> | |
</head> | |
<body<html> | |
<head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2016/10/27 (c)yoya@awm.jp | |
// ref) https://github.com/yoya/IO_GIF/blob/master/IO/GIF.php | |
package main | |
import ( | |
"encoding/binary" | |
"fmt" | |
"io/ioutil" | |
"math" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2016/10/27 (c) yoya@awm.jp | |
// ref) https://github.com/yoya/IO_GIF/blob/master/IO/GIF.php | |
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"math" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2016/10/27 (c) yoya@awm.jp | |
// ref) https://github.com/yoya/IO_GIF/blob/master/IO/GIF.php | |
package main | |
import ( | |
"errors" | |
"fmt" | |
"io/ioutil" | |
"math" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert -size 200x200 xc:black -fill "#f00" -draw "circle 100,75 60,35" r.png | |
convert -size 200x200 xc:black -fill "#0f0" -draw "circle 75,125 35,85" g.png | |
convert -size 200x200 xc:black -fill "#00f" -draw "circle 125,125 85,85" b.png | |
composite r.png -compose plus g.png rg.png | |
composite rg.png -compose plus b.png rgb.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert -size 200x200 xc:white -fill "#0ff" -draw "rectangle 50,30 150,130" c.png | |
convert -size 200x200 xc:white -fill "#f0f" -draw "rectangle 20,70 120,170" m.png | |
convert -size 200x200 xc:white -fill "#ff0" -draw "rectangle 80,70 180,170" y.png | |
composite c.png -compose multiply m.png cm.png | |
composite cm.png -compose multiply y.png cmy.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Metropolitan Museum of Art Public Images Downloader | |
* (c) 2017/02/17(Fri) yoya@awm.jp | |
* Usage) php getMetImages.php MetObjects.csv | |
*/ | |
$file = new SplFileObject($argv[1]); | |
$file->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE); | |
$idx = 0; |