ฟังก์ชัน imagecolorat() รับดัชนีสีของพิกเซล
ไวยากรณ์
imagecolorat( $img, $x, $y )
พารามิเตอร์
-
img :สร้างภาพด้วยฟังก์ชัน imagecreatetruecolor()
-
x :พิกัด x ของจุด
-
ย: พิกัด y ของจุด
คืนสินค้า
ฟังก์ชัน imagecolorat() จะคืนค่าดัชนีสีหรือค่า FALSE เมื่อเกิดข้อผิดพลาด
ตัวอย่าง
ต่อไปนี้เป็นตัวอย่าง:
<?php
$img = imagecreatefrompng("http://www.tutorialspoint.com/images/tp-logo-diamond.png");
$rgb = imagecolorat($img, 15, 25);
$colors = imagecolorsforindex($img, $rgb);
var_dump($colors);
?> ผลลัพธ์
ต่อไปนี้เป็นผลลัพธ์:
array(4) { ["red"]=> int(255) ["green"]=> int(255) ["blue"]=> int(255) ["alpha"]=> int(127) }