GetImagePixels

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Locked
bman22

GetImagePixels

Post by bman22 »

I have been working on a project in which i need to get all of the pixel information from a picture. I found ImageMagick and MagickWand, and installed them on my server. I tried to follow the vague example given in the information on the MagickWand site, and cannot get the MagickGetImagePixels to return anything but the word "Array"

Code: Select all

<?php
	$magick_wand = NewMagickWand();
	MagickReadImage($magick_wand, $_GET['image']);
	$height = MagickGetImageHeight($magick_wand);
	$width = MagickGetImageWidth($magick_wand);
	$pixels = MagickGetImagePixels($magick_wand, 0, 0, 20, 24, 'RGBA', MW_charPixel);
	print$height . ", " . $width;
	echo"<br />";
	print "RGB(" . $pixles[1] . ", " . $pixles[2] . ", " . $pixles[3] . ");";
	echo"<br />";
?>
I used that test code just to see if i can get it to work, but it doesn't. What am i doing wrong?

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: GetImagePixels

Post by magick »

You misspelled pixels. We corrected that and the script seemed to work and returns:
  • 46, 70<br />RGB(47, 45, 255);<br />

bman22

Re: GetImagePixels

Post by bman22 »

I feel incredibly stupid. I looked over this code for almost an hour, trying to figure out what was wrong. Thank you for the help though.

Locked