~ubuntu-branches/debian/stretch/phatch/stretch

« back to all changes in this revision

Viewing changes to phatch/actions/minimum.py

  • Committer: Bazaar Package Importer
  • Author(s): Stani M
  • Date: 2009-10-01 05:36:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20091001053609-wvy9yu0u3i6fuv4t
Tags: 0.2.2-1
* Upstream bugfix release (Closes LP: #236548, #436595, #437161, 
 #437376, #437852, #439108, #439359, #440273, #440956)
* debian/control: Dropped dependency python-wxgtk2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
12
# GNU General Public License for more details.
13
 
 
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program.  If not, see http://www.gnu.org/licenses/
16
16
#
23
23
 
24
24
#---PIL
25
25
def init():
26
 
    global Image, ImageFilter
 
26
    global Image, ImageFilter, imtools
27
27
    import Image, ImageFilter
28
 
    
 
28
    from lib import imtools
 
29
 
29
30
def minimum(image,radius,amount=100):
30
31
    """Apply a filter
31
32
    - amount: 0-1"""
32
33
    minimumed  = image.filter(ImageFilter.MinFilter(radius))
33
34
    if amount < 100:
34
 
        return Image.blend(image, minimumed, amount/100.0)
 
35
        return imtools.blend(image, minimumed, amount/100.0)
35
36
    return minimumed
36
37
 
37
38
#---Phatch
38
39
class Action(models.Action):
39
40
    """"""
40
 
    
 
41
 
41
42
    label       = _t('Minimum')
42
43
    author      = 'Stani'
43
44
    email       = 'spe.stani.be@gmail.com'
46
47
    version     = '0.1'
47
48
    tags        = [_t('filter')]
48
49
    __doc__     = _t("Copies the minimum pixel value")
49
 
    
 
50
 
50
51
    def interface(self,fields):
51
52
        fields[_t('Radius')] = self.RankSizeField(self.RANK_SIZES[0])
52
53
        fields[_t('Amount')] = self.SliderField(100,1,100)
53
 
    
 
54
 
54
55
    icon = \
55
56
'x\xda\x01\x97\x08h\xf7\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x000\x00\
56
57
\x00\x000\x08\x06\x00\x00\x00W\x02\xf9\x87\x00\x00\x00\x04sBIT\x08\x08\x08\