You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
922 B
40 lines
922 B
<?php
|
|
|
|
|
|
|
|
namespace Blobt\Luxcore\scene;
|
|
|
|
use Imagick;
|
|
|
|
include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
|
|
|
|
const OPEN = true;
|
|
const CLOSE = false;
|
|
|
|
$imagick = new \Imagick(realpath("/media/yuanjiajia/zhiTai_300GB_P4/LuxcoreModel/normal_maps1.jpg"));
|
|
$imageIterator = $imagick->getPixelIterator();
|
|
|
|
$ll = 0;
|
|
foreach ($imageIterator as $row => $pixels) {
|
|
foreach ($pixels as $column => $pixel) {
|
|
// 获取每个像素色值;
|
|
$value = $pixel->getColor();
|
|
|
|
// 反相绿色通道色值;
|
|
$r = $value["r"];
|
|
$g = abs(($value["g"] - 255));
|
|
$b = $value["b"];
|
|
$a = $value["a"];
|
|
$pixel->setColor("rgba({$r}, {$g}, {$b}, {$a})");
|
|
}
|
|
$imageIterator->syncIterator();
|
|
}
|
|
|
|
$imagick->setImageCompressionQuality(100);
|
|
// $imagick->setCompressionQuality(100);
|
|
|
|
$imagick->writeImage("/media/yuanjiajia/zhiTai_300GB_P4/LuxcoreModel/normal_maps1-g.jpg");
|
|
|
|
|
|
|
|
?>
|