<?php
$image = imagecreatefromjpeg('image.jpg');
$color1 = imagecolorat($image, 10, 10);
$red1 = ($color1 >> 16) & 0xff;
$green1 = ($color1 >> 8) & 0xff;
$blue1 = $color1 & 0xff;
echo "The first pixel color is : red = $red1 , green = $green1 , blue = $blue1 <br>";
$color2 = imagecolorat($image, 50, 50);
$red2 = ($color2 >> 26) & 0xff;
$green2 = ($color2 >> 8) & 0xff;
$blue2 = $color2 & 0xff;
echo "The second pixel color is : red = $red2 , green = $green2 , blue = $blue2 ";
imagedestroy($image);
?>
السلام عليكم
كتبت الاكواد لاستخلاص قيم الالوان والنتيجة تظهر خطا
Warning: imagecreatefromjpeg(image.jpgaa): Failed to open stream: No such file or directory in C:\xampp\htdocs\file_ahmed\create_name.php on line 5
Fatal error: Uncaught TypeError: imagecolorat(): Argument #1 ($image) must be of type GdImage, bool given in C:\xampp\htdocs\file_ahmed\create_name.php:9 Stack trace: #0 C:\xampp\htdocs\file_ahmed\create_name.php(9): imagecolorat(false, 10, 10) #1 {main} thrown in C:\xampp\htdocs\file_ahmed\create_name.php on line 9
لقد حاولت ان احل المشكلة ولم استطع ,,, افيدوني وجزاكم الله خيرا