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.

GetImagePixels

Postby bman22 » 2009-10-19T16:38:23+00:00

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?
bman22
 
Posts: 2
Joined: 2009-10-19T16:34:30+00:00

Re: GetImagePixels

Postby magick » 2009-10-19T17:20:14+00:00

You misspelled pixels. We corrected that and the script seemed to work and returns:

    46, 70<br />RGB(47, 45, 255);<br />
User avatar
magick
Site Admin
 
Posts: 5671
Joined: 2003-05-31T11:32:55+00:00

Re: GetImagePixels

Postby bman22 » 2009-10-19T21:00:47+00:00

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.
bman22
 
Posts: 2
Joined: 2009-10-19T16:34:30+00:00


Return to MagickWand for PHP

Who is online

Users browsing this forum: No registered users and 2 guests