File: negate.php

package info (click to toggle)
php4-imagick 0.9.11-0.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 720 kB
  • ctags: 755
  • sloc: ansic: 4,373; php: 1,574; sh: 1,226; makefile: 82; awk: 27
file content (29 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?
        $handle = imagick_readimage( getcwd() . "/image.jpg" ) ;
        if ( imagick_iserror( $handle ) )
        {
                $reason      = imagick_failedreason( $handle ) ;
                $description = imagick_faileddescription( $handle ) ;

                print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ;
		exit ;
        }

	imagick_negate( $handle, 0 ) ;
	//
	//  or, imagick_negate( $handle, 1 ).  1 and 0 are the only valid
	//  values for the second parameter.  1 means that only the gray scale
	//  within the image should be negated.
	//

        if ( !imagick_writeimage( $handle, getcwd() . "/new_image.jpg" ) )
        {
                $reason      = imagick_failedreason( $handle ) ;
                $description = imagick_faileddescription( $handle ) ;

                print "imagick_writeimage() failed<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ;
		exit ;
        }

        print "Done!<BR>\n" ;
?>