PHP 中的 imagecolorat() 函式
imagecolorat() 函式獲取畫素顏色的索引。
語法
imagecolorat( $img, $x, $y )
引數
img:用 imagecreatetruecolor() 函式建立一個影像。
x:點的 x 座標。
y:點的 y 座標。
返回值
imagecolorat() 函式返回顏色索引或在失敗時返回 FALSE。
示例
以下是一個示例
<?php
$img = imagecreatefrompng("https://tutorialspoint.tw/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) }
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP