1 ) { $opacity = 1; } ## validate color ## $color = colors( $color, "validate" ); if ( !$color ) { $_SESSION[error] = "Color is invalid"; header("location:$self"); exit; } ## end validate ## ############# $image = new Imagick($_SESSION[path]); foreach ($image as $frame) { $frame->colorizeimage("$color", $opacity ); } $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $frames = $image->getNumberImages(); if ( $frames > 1) { $image->writeImages("$path", TRUE); } else { $image->writeImage("$path"); } # save settings $_SESSION[path] = $path; $_SESSION[colorize_im_color] = $color; $_SESSION[colorize_im_opacity] = $opacity; header("Location: display.php"); exit; } ######### end Colorize include("top.php"); ?>
Color: "> Opacity: ">
Description
Uses Imagick to blend the fill color with each pixel in the image.
Parameters
color
Valid color name or hex
opacity
1.0 is fully opaque and 0.0 is fully transparent.