phatch-dev team mailing list archive
-
phatch-dev team
-
Mailing list archive
-
Message #00945
[Merge] lp:~jochym/phatch/Actions into lp:phatch
Paweł T. Jochym has proposed merging lp:~jochym/phatch/Actions into lp:phatch.
Requested reviews:
stani (stani)
I have developed two fairly usefull actions:
- making grid of images (grid) and
- toning (warm_up).
They prove useful in the working photographer toolbox.
They are based on other actions from the repo and
are appropriatly licensed (GPL3).
I'll be glad if this code can be included in the phatch distribution.
I am new to the phatch development but tried to obey the rules.
--
https://code.launchpad.net/~jochym/phatch/Actions/+merge/19100
Your team Phatch Developers is subscribed to branch lp:phatch.
=== added file 'phatch/actions/grid.py'
--- phatch/actions/grid.py 1970-01-01 00:00:00 +0000
+++ phatch/actions/grid.py 2010-02-11 14:10:26 +0000
@@ -0,0 +1,232 @@
+# 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/
+
+# Embedded icon is designed by Igor Kekeljevic (http://www.admiror-ns.co.yu).
+# Based on standard Stani's actions
+# This action is (C) 2010 by Pawel T. Jochym <jochym@xxxxxxxxx>
+
+# Make m x n grid with copies of imput image
+
+from core import models
+from core.translation import _t
+from lib.imtools import has_transparency
+from math import sqrt
+
+#---PIL
+def init():
+ global Image
+ import Image
+ global HTMLColorToRGBA
+ from lib.colors import HTMLColorToRGBA
+
+def make_grid(image,grid,background_colour,old_size=None,scale=True):
+ #check if there is any work to do
+ if grid[0]==1 and grid[1]==1:
+ return image
+ #because of layer support photo size can be different from image layer size
+ if old_size is None:
+ old_size = image.size
+ if scale :
+ # Keep the same number of pixels in the result
+ s=sqrt(grid[0]*grid[1])
+ old_size = tuple(map(lambda x: int(x/s) , old_size))
+ image=image.resize( old_size, getattr(Image,'ANTIALIAS'))
+
+ new_size=grid[0]*old_size[0],grid[1]*old_size[1]
+
+ #displacement
+ dx, dy = old_size
+ n, m = grid
+
+ #mode
+ if has_transparency(image) and image.mode != 'RGBA':
+ # Make sure 'LA' and 'P' with trasparency are handled
+ image = image.convert('RGBA')
+ else :
+ image = image.convert('RGB')
+
+ new_canvas = Image.new(image.mode,new_size,background_colour)
+
+ for x in range(n):
+ for y in range(m):
+ new_canvas.paste(image,(x*dx,y*dy))
+
+
+ return new_canvas
+
+
+#---Phatch
+class Action(models.Action):
+ label = _t('Grid')
+ all_layers = True
+ author = 'Pawel T. Jochym'
+ email = 'jochym@xxxxxxxxx'
+ init = staticmethod(init)
+ pil = staticmethod(make_grid)
+ version = '0.2'
+ tags = [_t('size'),_t('compose'),_t('grid')]
+ update_size = True
+ __doc__ = _t('Make n x m grid of image')
+
+ def interface(self,fields):
+ fields[_t('Width')] = self.SliderField(1,1,8)
+ fields[_t('Height')] = self.SliderField(1,1,8)
+ fields[_t('Background Color')] = self.ColorField('#FFFFFF')
+ fields[_t('Scale to keep size')] = self.BooleanField(True)
+
+ def values(self,info):
+ #size
+ x0, y0 = info['size']
+ x1 = self.get_field('Width',info)
+ y1 = self.get_field('Height',info)
+ grid = x1,y1
+ #parameters
+ return {
+ 'old_size' : (x0,y0),
+ 'grid' : grid,
+ 'background_colour' : self.get_field('Background Color', info),
+ 'scale' : self.get_field('Scale to keep size', info),
+ }
+
+ icon = \
+'x\xda\x01\xde\x0c!\xf3\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\x0c\x95IDATh\x81\xd5\x98{l\x15\xd7\x9d\xc7\xbf\xe71\
+\xcf{\xa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x1c\x13\xb2\xc7\x04\x1b4\xa1\x13\
+\x0bq3\x0fq+\x0f\t+\x0fE\xe6x\x8c\xd1\xc7\xc30\x0ch\x9a\xa6\x00\x10\xc7q\xf0\
+\xee\xbb\xefb\xe6\xcc\x99\x981c\x06ZZZ\xc0\x18\xfb-\xa5t\x86R\xea.\x00\x17\
+\x01\xd4\xfb\xbe\xbf\x83\x10r/!d=\x00PJ\xef,//\xff\x10\x18\xddB\xe4\x95W^yY\
+\x08Q\xce\x18#\xef\x8b\x038,\xff\x00\xc5}P\x92\xa9\x1b\xa1\x80\xa2\x12.\x1d\
+\x80K\x07 ]\xc0\xf9\x04Hu\x00\xd2\xcd\x18\x16\x0c\xa0\x1a@u\x80\x9a\xc0\xd8\
+\xc4\xcd\x98wS9JK\xa6\x931c\xc6$\x0f\x1f><p\xdbm\xb7\xdd\xde\xde\xde\x8et:\
+\x1dVmq\x90\xd43\x8e\xe3\xdc\xb5b\xc5\x8a\xee@SSeee\x99R\xea\xcet:\xad\x13B\
+\x88RJ]\x06P__?\xae\xaf\xaf\xef\x80R\xea\x0b>\xf5p ]\x83v\xf5^F\x0c\x05@2\
+\xe2C\x08B\x01_\x00^/\xe0\xf6\x00J\x02\xcc\xcc\x88f&\xc0\xf3\x00=\x1f\xd0\n\
+\x01?\xd6\x89&\xebE\x8c\xcb\xff\x0f\x14\xc4\xa6\x8e\x9f;w\xee\xf8c\xc7\x8e\
+\xa1\xa8\xa8\x08\xba\xaeKB\x08SJA)\x95r\x1c\xe7\x81\x95+W\xf6df\xca\xe4C\x08\
+1N)\xe5uuuu\x02 \x84\x90\x91\x16\xaa\xad\xad\xfd~:\x9d\xde\xa9\x94\xb2\xcf\
+\xfb\x1d\xd8\xeb\xbe\x84^\xf5IF4\t\x1eC.\t\x0f\xaf\x8b\x01`\xa83s\xa6\x06\
+\xa0\xe5\x07\x91\x00\x98}\t\x86r\x80p\x80P\x8a9V9\xbe\xa3\xff+\x08\x08\xce\
+\x9d;\xe7\x9e>}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G\xf4\xc0\x86\r\x1b\x12\x96e\xfdOII\xc9}\
+\x9a\xa6\xe1\x13\xbf\x1d\xff\xedn\x18\xee\x83h\xf6m-\x06S\x8b\xc1\xd2b\xb0\
+\xb8\rC\xb3`p\x0b:7\xa01\x03\x1a\xe3`4\xb3\xfb\x82\x00\n\x19\x00\xa9\x04\xee\
+d\xf7a\x16\xfb\x01\xa0\x80\xd3\xa7O{\x87\x0e\x1dzd\xfd\xfa\xf5\xbb\x9f\x7f\
+\xfe\xf9n\xa5\x94\xa5\x94\xea\x12B\xbc\xc39\xff&!$_)\xd5}\xe2\xc4\x89\x07\
+\xeb\xea\xea>\x00\xe0\x05!\x00\x88\x9c\xfb\xc0\x0b/\xbc\xb0z\xc2\x84\t\xebc\
+\xb1\x18u1\x88\xdd\xe9\x17\xd1&\x8f\x0cC\x18\xdc\x84\xa5\xc5ak1XZ\x1cV\x00c2\
+\x1b\xa6fAg&tf\x80S\x0eJ9\x08\x08\x14\x14\x188\xbe\xc2\xe6a<\x99\x06!\x04\
+\x8e\x1d;\xd6\xfd\xdak\xaf}w\xd7\xae]\x7f\x07\x80g\x9eyf\x8da\x18+\xa3Z\x84\
+\x10\x07[[[\xd7444\x9c\x0cDG\x01\xe4\xa8\x1b\xd9s\xcf=wwii\xe9\xde\x92\x92\
+\x92\x02B\t\xfe$v\xa0)\xbd\x05 >,=\x8e\x98\x96\x80\xcd\x13\xb0\xf5x\x06\x86\
+\'`\xf1\x18L\x1e\x83\xc9m\x18\xcc\x82Fup\xa2\x83\x12\x8a8\x8a0\x93\x7f\x1b\
+\x16\x12\xe8\xef\xefGccc\xcb\xbau\xeb\x1e\xe8\xee\xeev\x91y\xfbDAA\x81^VV\
+\xf6\x93x<~\x9f\x94\xb2\xab\xbb\xbb\xfb\xcd-[\xb6\xfc)\x18\xcf\x16/\x00\xf89\
+\x01\x08\xc98~\xe9\xd2\xa5E3g\xce\xdc=u\xea\xd4{u]G\xbbz\x0f;\x9d\xf5P\x9a\
+\x8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x151"\xd79\xb2\xde\xe1s\x88\xcf\
+\xf6|vd/\x999\x1b7z\xe4\xac\x80RJe\x18 \xa3\x97#\x0f\xcd\xce\xa8\x1f@\xf8Y\
+\x10\xd9\r\x1bf=\x97\xf0\xd02W,~T\x80\x1c\x10\n\xb9\x1b1;\xb4\xe0\xcc\xb2\
+\x00re\xde\xc1\xe5;m\xce\xcd\xea\x9a\x00\xb2 \xc2\x15 \n\x90\xdd\x94\x12\x19\
+K\xc9\xe0\xb9\xa1\x85\xa2k}\xae\xac{\xb8\xfc]\x08W"\xfes\x01r@|^%$.\xf5C\x14\
+ \xda\xb4\xd9\x96\x89\x8a\xbf\xa2\xac_\x15@\x08\x81\xccO\xdd\xa1\xa8\\;j\xb4\
+I\xc3>P\x18Y\x01\x0f\x9f\xf3rv5\xe2\xaf\x18 \nB\x08\xf1q)\xbb\xd9U\x08\xb3\
+\x1d\xf6\x00\xb2\xc0\xc2\xf3\x88\xac_\xab\xf8\xab\x06\x88@\x00\x97[*\x04\x08\
+\x97^\x12\x19\x0b!\xa2\xfdrM\x96\xb9n\x80,\x88p\xf2h%\xc2%\x14Yc\xd1&\xbd\
+\xae\xacG\x8f\xff\x05\xd8\xb6\xb3*\x16\xb11e\x00\x00\x00\x00IEND\xaeB`\x82\
+\xc6\x87\x0e\x81'
=== 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-11 14:10:26 +0000
@@ -0,0 +1,161 @@
+# 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
+ import Image, ImageMath, ImageColor
+
+def warmup(image,midtone,brighten,amount=100):
+ """Apply a filter
+ - amount: 0-1"""
+ if image.mode != 'L':
+ im = image.convert('L')
+ else:
+ im = image
+
+ irgb=im.convert('RGB').split()
+ 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=irgb[l].convert('F'),
+ m=4*((m[l]/255.0)-0.5+b)/255.0 ).convert('L'))
+
+ colorized = Image.merge('RGB',(o[0],o[1],o[2]) )
+
+ if image.mode == 'RGBA':
+ colorized = colorized.convert('RGBA')
+ colorized.putalpha(image.split()[-1])
+
+ if amount < 100:
+ return Image.blend(image, colorized, amount/100.0)
+
+ return colorized
+
+#---Phatch
+class Action(models.Action):
+ label = _t('WarmUp')
+ author = 'Pawel T. Jochym'
+ email = 'jochym@xxxxxxxxx'
+ init = staticmethod(init)
+ pil = staticmethod(warmup)
+ version = '0.2'
+ tags = [_t('filter')]
+ __doc__ = _t('Warm up midtones of greyscale image')
+
+ def interface(self,fields):
+ fields[_t('Midtone')] = self.ColorField('#888888')
+ fields[_t('Brighten')] = self.SliderField(0,0,100)
+ fields[_t('Amount')] = self.SliderField(100,1,100)
+
+ icon = \
+'x\xda\x01\x1f\x08\xe0\xf7\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00*\
+\x00\x00\x00*\x08\x06\x00\x00\x00\xc5\xc3\xc9[\x00\x00\x00\x04sBIT\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xf8XL\x804*\xa03\xae\xb8(\xb92\x0bp\x19\xc0\x9b\
+T\x96\xdd\x9d\xa1\xee\xce\xf2\xac\xec\x13mN\x11\xb1T\x06\x81\xb5\xc0\x12\xc0\
+_\x82R&\x7f4\xcd\xa77>\x1d`.w\xeeR\x9f\xd2F\x99\xb6\xacX\x00XTr\x7f\xe9\xfed\
+\xd0\x99\xa0\xee\xb5\xf3\xe9\xd7\xda\xb4{\xea\xa4z\xb9\x9c,\x90\x0b\xb7C\xef\
+\x03\xc2%\xaf,y\xc5$u\xcb\xe1\x87\x99C<=\xd4wS\xf5n\x83r\xca\xfd\x94\x15\x9d\
+XL\xa5\x15\xab\x96F\xac\x96|\xfa\xbc\x9c\xcb\x99T\x96\x95\x98i0\x93\x07:\xd3\
+b\xbbc~\x02\xfc\x0f\'\xc4\x97\xb6\x97\xab\xbe\x05\x00\x00\x00\x00IEND\xaeB`\
+\x82`8\xef\xcc'
Follow ups