Blender渲染
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

  1. <?php
  2. namespace Blobt\Luxcore\scene;
  3. use Imagick;
  4. include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
  5. const OPEN = true;
  6. const CLOSE = false;
  7. $imagick = new \Imagick(realpath("/media/yuanjiajia/zhiTai_300GB_P4/LuxcoreModel/normal_maps1.jpg"));
  8. $imageIterator = $imagick->getPixelIterator();
  9. $ll = 0;
  10. foreach ($imageIterator as $row => $pixels) {
  11. foreach ($pixels as $column => $pixel) {
  12. // 获取每个像素色值;
  13. $value = $pixel->getColor();
  14. // 反相绿色通道色值;
  15. $r = $value["r"];
  16. $g = abs(($value["g"] - 255));
  17. $b = $value["b"];
  18. $a = $value["a"];
  19. $pixel->setColor("rgba({$r}, {$g}, {$b}, {$a})");
  20. }
  21. $imageIterator->syncIterator();
  22. }
  23. $imagick->setImageCompressionQuality(100);
  24. // $imagick->setCompressionQuality(100);
  25. $imagick->writeImage("/media/yuanjiajia/zhiTai_300GB_P4/LuxcoreModel/normal_maps1-g.jpg");
  26. ?>