View Full Version : How would I make an image pre-processor?
03-18-2003, 12:12 AM
Say I've got a GIF image - I want to extract its pixel data, do a transformation on each color value, and then generate a new image with these values.
The middle bit is easy; but the first and last bit I have no idea about - I guess I need some kind of library or extension to do this?
could and do do it for jpeg, bmp and png (and possibly even swf at a push) though without the rights to the LZW compression algorythm, reading/writing gifs would be darn tricky.
Take a gander at GD / Gimp (and script-fu) or ImageMagick for image manipulations.
I'll be ready to answer any GD related questions.
03-18-2003, 12:46 AM
The GD library has lots of image manipulation functions:
03-18-2003, 12:52 AM
Thanks guys; I'll check it out :thumbsup:
There is a rather useful GD2+ manipulation class that extends the basic functionality of GD spreading through various sites (resourceindex.com, phpclasses.org, phpfreaks.com and phpbuilder.com.
) - main page:
The drop-shadow effect could do with some work - when I get the time and motivation :)
if you wanted the rgb of a pixel, you could use
// $this->r = image height
for( $this->dy = 0; $this->dy <= $this->r; $this->dy++ )
// this->q = image width
for( $this->dx = 0; $this->dx <= $this->q; $this->dx++ )
$this->pxrgb = imagecolorat($this->t, $this->dx, $this->dy);
$this->rgb = ImageColorsforIndex( $this->t, $this->pxrgb );
// leaves $this->rgb['red'] = the red value etc - 'green' - 'blue'
$this->setcol = ImageColorAllocate( $this->t, $this->newcol, $this->newcol, $this->newcol );
imagesetpixel( $this->t, $this->dx, $this->dy, $this->setcol );
might give you a hint of functions to use for a procedural approach anyway.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.