XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
enhancements.php
Go to the documentation of this file.
1 <?php
2 /*
3  +--------------------------------------------------------------------------------------------+
4  | DISCLAIMER - LEGAL NOTICE - |
5  +--------------------------------------------------------------------------------------------+
6  | |
7  | This program is free for non comercial use, see the license terms available at |
8  | http://www.francodacosta.com/licencing/ for more information |
9  | |
10  | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
11  | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12  | |
13  | USE IT AT YOUR OWN RISK |
14  | |
15  | |
16  +--------------------------------------------------------------------------------------------+
17 
18 */
31 
32  function denoise(phmagick $p, $amount=1){
33  $cmd = $p->getBinary('convert');
34  $cmd .= ' -noise '.$amount ;
35  $cmd .= ' -background "none" "' . $p->getSource() .'"';
36  $cmd .= ' "' . $p->getDestination() .'"';
37 
38  $p->execute($cmd);
39  $p->setSource($p->getDestination());
40  $p->setHistory($p->getDestination());
41  return $p ;
42  }
43 
44 
45  function sharpen(phmagick $p, $amount =10){
46  $cmd = $p->getBinary('convert');
47  $cmd .= ' -sharpen 2x' .$amount ;
48  $cmd .= ' -background "none" "' . $p->getSource() .'"';
49  $cmd .= ' "' . $p->getDestination() .'"';
50 
51  $p->execute($cmd);
52  $p->setSource($p->getDestination());
53  $p->setHistory($p->getDestination());
54  return $p ;
55  }
56 
57  function smooth(phmagick $p){
58  $cmd = $p->getBinary('convert');
59  $cmd .= ' -despeckle -despeckle -despeckle ' ;
60  $cmd .= ' -background "none" "' . $p->getSource() .'"';
61  $cmd .= ' "' . $p->getDestination() .'"';
62 
63  $p->execute($cmd);
64  $p->setSource($p->getDestination());
65  $p->setHistory($p->getDestination());
66  return $p ;
67  }
68 
69  function saturate(phmagick $p, $amount=200){
70  $cmd = $p->getBinary('convert');
71  $cmd .= ' -modulate 100,' .$amount ;
72  $cmd .= ' -background "none" "' . $p->getSource().'"' ;
73  $cmd .= ' "' . $p->getDestination().'"' ;
74 
75  $p->execute($cmd);
76  $p->setSource($p->getDestination());
77  $p->setHistory($p->getDestination());
78  return $p ;
79  }
80 
81  function contrast(phmagick $p,$amount=10){
82  $cmd = $p->getBinary('convert');
83  $cmd .= ' -sigmoidal-contrast ' .$amount. 'x50%' ;
84  $cmd .= ' -background "none" "' . $p->getSource().'"' ;
85  $cmd .= ' "' . $p->getDestination().'"' ;
86 
87  $p->execute($cmd);
88  $p->setSource($p->getDestination());
89  $p->setHistory($p->getDestination());
90  return $p ;
91  }
92 
93 
94  function edges(phmagick $p,$amount=10){
95  $cmd = $p->getBinary('convert');
96  $cmd .= ' -adaptive-sharpen 2x' .$amount ;
97  $cmd .= ' -background "none" "' . $p->getSource() .'"';
98  $cmd .= ' "' . $p->getDestination() .'"';
99 
100  $p->execute($cmd);
101  $p->setSource($p->getDestination());
102  $p->setHistory($p->getDestination());
103  return $p ;
104  }
105 
106 }
107 ?>