You are here: Re: jpeg image decompiling « PHP Programming Language « IT news, forums, messages
Re: jpeg image decompiling

Posted by William Gill on 08/30/07 14:25

>
> <http://nl3.php.net/imagecolorat>
>
> $im = imagecreatefromjpeg("/your/image/file");
>
> $pixels = array();
> for($x = 0; $x < imagesx($im); $x++){
> for($y = 0; $y < imagesy($im);$y++){
> $rgb = imagecolorat($im, $x, $y);
> //either:
> $pixels[$x][$y] = imagecolorsforindex($im,$rgb);
> //or:
> $r = ($rgb >> 16) & 0xFF;
> $g = ($rgb >> 8) & 0xFF;
> $b = $rgb & 0xFF;
> $pixels[$x][$y] = array($r,$g,$b);
> }
> }
>
Thanks, Rik.

I played with imagecolorat() before, but it didn't seem to work with a
non indexed color image (i.e. it worked with a gif, but not a jpeg).
Reading the spec seemed to confirm that the function returns the color
index (not the color), which can then be read for rgb values. I was
able to convert the jpeg to an indexed image, then use imagecolorat(),
but it meant reducing the original to 256 colors first.

I will try again, using your snippet, and let you know.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация