← Back to team overview

phatch-dev team mailing list archive

[Merge] lp:~jochym/phatch/warm_up_action into lp:phatch

 

Paweł T. Jochym has proposed merging lp:~jochym/phatch/warm_up_action into lp:phatch.

    Requested reviews:
    stani (stani)


This is branch separated from Actions(parent) in the one-action-per-branch style.
This branch has only WarmUp action and all corrections/changes suggested by
Stani have been incorporated. 

I think it is ready to consider for merging into the trunk.

-- 
https://code.launchpad.net/~jochym/phatch/warm_up_action/+merge/19402
Your team Phatch Developers is subscribed to branch lp:phatch.
=== added file 'phatch/actions/warm_up.py'
--- phatch/actions/warm_up.py	1970-01-01 00:00:00 +0000
+++ phatch/actions/warm_up.py	2010-02-16 14:20:30 +0000
@@ -0,0 +1,204 @@
+# Phatch - Photo Batch Processor
+# Copyright (C) 2007-2008 www.stani.be
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/
+#
+# Phatch recommends SPE (http://pythonide.stani.be) for editing python files.
+
+# Embedded icon is designed by Igor Kekeljevic (http://www.admiror-ns.co.yu).
+# Based on Stani's colorize
+# This action is (C) 2010 by Pawel T. Jochym <jochym@xxxxxxxxx>
+
+# Make a colorized version of the image with midtone shifted to 
+# prescribed color value. 
+
+from core import models
+from core.translation import _t
+
+#---PIL
+def init():
+    global Image, ImageMath, ImageColor, imtools
+    import Image, ImageMath, ImageColor
+    from lib import imtools
+    
+def warmup(image,midtone,brighten,amount=100):
+    """Apply a toning filter. Move the midtones to the desired
+    color while preserving blacks and whites with optional mixing 
+    with original image - amount: 0-100%"""
+    
+    mode=image.mode
+    info=image.info
+    
+    if image.mode != 'L':
+        im = imtools.convert(image,'L')
+    else:
+        im = image
+
+    if imtools.has_transparency(image):
+        image = imtools.convert(image,'RGBA')
+            
+    luma=imtools.convert(im.split()[0],'F')
+    o=[]
+    m=ImageColor.getrgb(midtone)
+    b=brighten/600.0
+    # Calculate channels separately
+    for l in range(3):
+        o.append(ImageMath.eval(
+            "m*(255-i)*i+i", 
+            i=luma, 
+            m=4*((m[l]/255.0)-0.5+b)/255.0 ).convert('L'))
+    
+    colorized = Image.merge('RGB', tuple(o) )
+    
+    if imtools.has_alpha(image):
+        imtools.put_alpha(colorized, image.split()[-1])
+
+    if amount < 100:
+        colorized=imtools.blend(image, colorized, amount/100.0)
+    
+    return colorized
+
+#---Phatch
+class Action(models.Action):
+    label       = _t('Warm Up')
+    author      = 'Pawel T. Jochym'
+    email       = 'jochym@xxxxxxxxx'
+    init        = staticmethod(init)
+    pil         = staticmethod(warmup)
+    version     = '0.2'
+    tags        = [_t('filter'),_t('color')]
+    __doc__     = _t('Warm up or colorize midtones of an image')
+    
+    def interface(self,fields):
+        fields[_t('Midtone')]  = self.ColorField('#805d40')
+        fields[_t('Brighten')]  = self.SliderField(50,0,100)
+        fields[_t('Amount')] = self.SliderField(50,1,100)
+
+    icon = \
+'x\xda\x01p\x0b\x8f\xf4\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x000\x00\
+\x00\x000\x08\x06\x00\x00\x00W\x02\xf9\x87\x00\x00\x00\x04sBIT\x08\x08\x08\
+\x08|\x08d\x88\x00\x00\x0b\'IDATh\x81\xd5\x99}\x8c\x9c\xc7]\xc7?3\xf3\xbc\
+\xec\xcb\xbd\xda\xb7\xf7\xeas\xac\xe4\xe2:i\xac\x928mP\x9a\x94\xaa/$\xc4i*\
+\x02\xe1\x0fT(\x12B\xa0\x12U\xc0\x1fH\xfcE\xfeF\x88\x7f\x88\x00\x81\x00\x11\
+\x89R\x91\xa8\xa8\x8d\x94\xd4\x10\xd1\x04\x1a[\xads\x89\x82\x89]_\xec\xd4v.\
+\xb6\xef\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a\x91\x91\x11o\x8c\xf1\x07\x0f\x1etq\x1c\xbbZ\xad\xe6\xf3<\x97;\xef\
+\xbc\xd3\x03~\x13\xe2G\x04\xffO\xb3\x90\x9a\x9f\x9f\x0f\xf6\xee\xddk.\\\xb8\
+\x10$I\xa2\xdf|\xf3Ms\xe6\xcc\x19}\xf5\xeaU\xd3\xe9t\x82n\xb7\x1bZk\x83<\xcf\
+C\xe7\\p\xad\x8a\x88\xf1\xde\x9b \x08\x94\x88\xbc\x9fgJ)_\x14\x85h\xad\x9d\
+\xd6\xba\xd0Z;cLa\x8c)\xa2(\xb2q\x1c\xdbR\xa9T\x8c\x8f\x8f\x17\x87\x0e\x1dr\
+\xb3\xb3\xb3\xfe\xc0\x81\x03\xae(\nW\xa9T\x8a\xb9\xb99\xbb]\x00\x05\xe8#G\
+\x8e\x98\xb3g\xcf\x86\x0b\x0b\x0b\xfa\xd5W_\r.]\xba\x14...\x06\xf5z=L\x92$\
+\x06"\x11\x89E$\x06b\x11\x89\x80\x08\x08\xb7T\xc3\xf5\xf3g\x07\x14\x9b5\x07r\
+\xa5T\x0ed\xd7\xda8\x8e\xb3J\xa5\x92_\xbat\xc9\x8e\x8d\x8d\xd9\xbb\xee\xba\
+\xcb\xdes\xcf=nzzZ\xcd\xcd\xcd}\xc0\x0b?i\x16\x92g\x9f}\x96\x0b\x17.\x00\xb0\
+\xb6\xb6\xa6\x93$\xd1Y\x96\x19cL\x18\x04\xc15\xf1%\x11)\x01e\x11)\x03U`\x00\
+\x18\x14\x91!\x11\x19\x16\x91\x11\x11\xd9\xb3YGEd\x18\x18\x02\x06\x81\x01\
+\x11\xa9\x02U\x11)\x8bH\xd9{_\xd6Z\x97\xd24\x8d:\x9dN\xb8\xba\xba\x1a4\x1a\r\
+\r0??\xff\x01\xa1?1\x846\x13\xa88q\xe2\x84\x9a\x9d\x9dUq\x1c\xab\x8b\x17/\
+\x16\x0b\x0b\x0bjxx\x98V\xab%\xd6Z)\x8a\xc29\xe7\n\xe7\\\xee\xbd\xcf\xbc\xf7\
+\x91\x88D"\x12\x8aH "\xc1\xe6@\x89R\xca)\xa5,Ph\xads\xa5\x94\xd5Z\xe7\xc6\
+\x98\\k\x9d\x07A\x90W\xab\xd5|``\xc0\x8e\x8f\x8f\xe7SSSv\xef\xde\xbd\xb6\\.\
+\xe7\xfb\xf6\xed\xb3sss\x8e\x1d\xe4\x80\x00nqqQ\xa2(rw\xdf}\xb7v\xce\x99\xd1\
+\xd1QS\xaf\xd7C\xe7\x9ci6\x9bA\x92$&\xcb2\x93\xa6i\xa0\x942y\x9e\x07EQ\x18\
+\xe7\x9cq\xce\x19\xef\xbd\x16\x11\xa5\x94\x12\xad\xb5\xd7Z{c\x8c\x0b\x82\xc0\
+\x05A\xe0\x80"\x8a"\x17E\x91\xabV\xabE\xb5Zu\xde{;<<l\xf7\xef\xdf\xef\xc6\
+\xc6\xc6\xdc\xe1\xc3\x87\xdd\xdc\xdc\x9cSJ\xc9\x7f\x9ft\xfe\x0b\xa6&\x926\
+\xd8\x8d\xfa\xa5\x00\x00\x00\x00IEND\xaeB`\x82\xb6>\x9f:'
+
+


Follow ups