~ubuntu-branches/debian/jessie/phatch/jessie

« back to all changes in this revision

Viewing changes to phatch/actions/common.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 common(image,radius,amount=100):
30
31
    """Apply a filter
31
32
    - amount: 0-1"""
32
33
    commoned  = image.filter(ImageFilter.ModeFilter(radius))
33
34
    if amount < 100:
34
 
        return Image.blend(image, commoned, amount/100.0)
 
35
        return imtools.blend(image, commoned, amount/100.0)
35
36
    return commoned
36
37
 
37
38
#---Phatch
44
45
    version     = '0.1'
45
46
    tags        = [_t('filter')]
46
47
    __doc__     = _t("Copies the most common pixel value")
47
 
    
 
48
 
48
49
    def interface(self,fields):
49
50
        fields[_t('Radius')] = self.RankSizeField(self.RANK_SIZES[0])
50
51
        fields[_t('Amount')] = self.SliderField(100,1,100)
51
 
        
 
52
 
52
53
    icon = \
53
54
'x\xda\x01\x14\r\xeb\xf2\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x000\x00\
54
55
\x00\x000\x08\x06\x00\x00\x00W\x02\xf9\x87\x00\x00\x00\x04sBIT\x08\x08\x08\