Mercurial > repos > tomasz-bednarz > filter_tools
changeset 2:a44112280169
Uploaded
author | tomasz-bednarz |
---|---|
date | Mon, 25 Nov 2013 21:12:30 -0500 |
parents | 795060eb6643 |
children | 952a37c4ffc8 |
files | filter_tools test-data/images/sydney.jpg tools/blur.xml tools/contour.xml tools/detail.xml tools/detial.xml tools/edge_enhance.xml tools/edge_enhance_more.xml tools/emboss.xml tools/find_edges.xml tools/invert.xml tools/max.xml tools/median.xml tools/min.xml tools/mode.xml tools/pil_filter.py tools/sharpen.xml tools/smooth.xml tools/smooth_more.xml tools/smoth.xml tools/smoth_more.xml |
diffstat | 18 files changed, 605 insertions(+), 157 deletions(-) [+] |
line wrap: on
line diff
--- a/filter_tools Mon Nov 25 21:11:51 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> -<head> -<link rel="icon" href="/repos/tomaszbednarz/filter_tools/static/hgicon.png" type="image/png" /> -<meta name="robots" content="index, nofollow" /> -<link rel="stylesheet" href="/repos/tomaszbednarz/filter_tools/static/style-paper.css" type="text/css" /> -<script type="text/javascript" src="/repos/tomaszbednarz/filter_tools/static/mercurial.js"></script> - -<title>filter_tools: log</title> -<link rel="alternate" type="application/atom+xml" - href="/repos/tomaszbednarz/filter_tools/atom-log" title="Atom feed for filter_tools" /> -<link rel="alternate" type="application/rss+xml" - href="/repos/tomaszbednarz/filter_tools/rss-log" title="RSS feed for filter_tools" /> -</head> -<body> - -<div class="container"> -<div class="menu"> -<div class="logo"> -<a href="http://mercurial.selenic.com/"> -<img src="/repos/tomaszbednarz/filter_tools/static/hglogo.png" alt="mercurial" /></a> -</div> -<ul> -<li class="active">log</li> -<li><a href="/repos/tomaszbednarz/filter_tools/graph/43c33624462a">graph</a></li> -<li><a href="/repos/tomaszbednarz/filter_tools/tags">tags</a></li> -<li><a href="/repos/tomaszbednarz/filter_tools/bookmarks">bookmarks</a></li> -<li><a href="/repos/tomaszbednarz/filter_tools/branches">branches</a></li> -</ul> -<ul> -<li><a href="/repos/tomaszbednarz/filter_tools/rev/43c33624462a">changeset</a></li> -<li><a href="/repos/tomaszbednarz/filter_tools/file/43c33624462a">browse</a></li> -</ul> -<ul> - -</ul> -<ul> - <li><a href="/repos/tomaszbednarz/filter_tools/help">help</a></li> -</ul> -</div> - -<div class="main"> -<h2><a href="/repos/tomaszbednarz/filter_tools/">filter_tools</a></h2> -<h3>log</h3> - -<form class="search" action="/repos/tomaszbednarz/filter_tools/log"> - -<p><input name="rev" id="search1" type="text" size="30" /></p> -<div id="hint">find changesets by author, revision, -files, or words in the commit message</div> -</form> - -<div class="navigate"> -<a href="/repos/tomaszbednarz/filter_tools/shortlog/14?revcount=30">less</a> -<a href="/repos/tomaszbednarz/filter_tools/shortlog/14?revcount=120">more</a> -| rev 14: <a href="/repos/tomaszbednarz/filter_tools/shortlog/ca29971c256c">(0)</a> <a href="/repos/tomaszbednarz/filter_tools/shortlog/tip">tip</a> -</div> - -<table class="bigtable"> - <tr> - <th class="age">age</th> - <th class="author">author</th> - <th class="description">description</th> - </tr> - <tr class="parity0"> - <td class="age">Tue, 29 Oct 2013 14:01:57 +1100</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/43c33624462a">README update</a><span class="branchhead">default</span> <span class="tag">tip</span> </td> - </tr> - <tr class="parity1"> - <td class="age">Tue, 29 Oct 2013 13:58:09 +1100</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/1edbb9fcb092">image</a></td> - </tr> - <tr class="parity0"> - <td class="age">Tue, 29 Oct 2013 13:21:34 +1100</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/9a9b4ee15f18">filters</a></td> - </tr> - <tr class="parity1"> - <td class="age">Tue, 29 Oct 2013 13:18:24 +1100</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/3f66638d282c">added filters</a></td> - </tr> - <tr class="parity0"> - <td class="age">Tue, 29 Oct 2013 13:12:34 +1100</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/b82e05449782">filter tools</a></td> - </tr> - <tr class="parity1"> - <td class="age">Tue, 29 Oct 2013 13:11:26 +1100</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/d12e3cab5a09">.</a></td> - </tr> - <tr class="parity0"> - <td class="age">Fri, 18 Oct 2013 04:11:27 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/a8153f8e5c98">.</a></td> - </tr> - <tr class="parity1"> - <td class="age">Fri, 18 Oct 2013 04:09:45 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/c3286d0b15c1">.</a></td> - </tr> - <tr class="parity0"> - <td class="age">Fri, 18 Oct 2013 04:02:06 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/0a4e1780c0a8">filters</a></td> - </tr> - <tr class="parity1"> - <td class="age">Fri, 18 Oct 2013 00:40:53 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/d11da0591d83">.</a></td> - </tr> - <tr class="parity0"> - <td class="age">Thu, 17 Oct 2013 23:13:07 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/024a6ea33b54">.</a></td> - </tr> - <tr class="parity1"> - <td class="age">Thu, 17 Oct 2013 22:57:23 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/9f2409afab3e">test only</a></td> - </tr> - <tr class="parity0"> - <td class="age">Wed, 16 Oct 2013 16:34:53 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/6ed9a0945b3d">medium</a></td> - </tr> - <tr class="parity1"> - <td class="age">Wed, 16 Oct 2013 16:24:36 -0700</td> - <td class="author">tomasz bednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/3d1f04a6c674">First tool</a></td> - </tr> - <tr class="parity0"> - <td class="age">Wed, 16 Oct 2013 23:17:28 +0000</td> - <td class="author">tomaszbednarz</td> - <td class="description"><a href="/repos/tomaszbednarz/filter_tools/rev/ca29971c256c">Uploaded</a></td> - </tr> - -</table> - -<div class="navigate"> -<a href="/repos/tomaszbednarz/filter_tools/shortlog/14?revcount=30">less</a> -<a href="/repos/tomaszbednarz/filter_tools/shortlog/14?revcount=120">more</a> -| rev 14: <a href="/repos/tomaszbednarz/filter_tools/shortlog/ca29971c256c">(0)</a> <a href="/repos/tomaszbednarz/filter_tools/shortlog/tip">tip</a> -</div> - -</div> -</div> - -<script type="text/javascript">process_dates()</script> - - -</body> -</html> -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/blur.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_blur" name="Filter - Blur" version="1.0.2"> + + <description>Apply a blur filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output blur jpeg + #else: + pil_filter.py $input $output blur ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Blur on ${input.display_name}"/> + </outputs> + + <help> + Apply a blur filter on the image (soften the image). + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-blur.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/contour.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_contour" name="Filter - Contour" version="1.0.2"> + + <description>Apply a contour filter on image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output contour jpeg + #else: + pil_filter.py $input $output contour ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Contour on ${input.display_name}"/> + </outputs> + + <help> + Apply a sharpen filter on the image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-contour.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/detail.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_detail" name="Filter - Detail" version="1.0.2"> + + <description>Apply a detail filter on image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output detail jpeg + #else: + pil_filter.py $input $output detail ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Detail on ${input.display_name}" /> + </outputs> + + <help> + Apply a detail filter on image (unsharp mask). + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-detail.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/edge_enhance.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_edge_enhance" name="Filter - Edge Enhance" version="1.0.2"> + + <description>Apply an edge_enhance filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output edge_enhance jpeg + #else: + pil_filter.py $input $output edge_enhance ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Edge enhance on ${input.display_name}"/> + </outputs> + + <help> + Apply an edge_enhance filter on the image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-edge-enhance.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/edge_enhance_more.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_edge_enhance_more" name="Filter - Edge Enhance More" version="1.0.2"> + + <description>Apply an edge_enhance_more filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output edge_enhance_more jpeg + #else: + pil_filter.py $input $output edge_enhance_more ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Edge enhance more on ${input.display_name}"/> + </outputs> + + <help> + Apply an edge_enhance_more filter on the image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-edge-enhance-more.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/emboss.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_emboss" name="Filter - Emboss" version="1.0.2"> + + <description>Apply an emboss filter on image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output emboss jpeg + #else: + pil_filter.py $input $output emboss ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Emboss on ${input.display_name}" /> + </outputs> + + <help> + An emboss filter gives a 3D shadow effect to the image, the result is very useful for a bumpmap of the image. It can be achieved by taking a pixel on one side of the center, and subtracting one of the other side from it. Pixels can get either a positive or a negative result. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-emboss.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/find_edges.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_find_edges" name="Filter - Find Edges" version="1.0.2"> + + <description>Apply find_edges filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output find_edges jpeg + #else: + pil_filter.py $input $output find_edges ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Find edges on ${input.display_name}"/> + </outputs> + + <help> + Apply an find_edges filter on the image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-find-edges.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/invert.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_invert" name="Filter - Invert" version="1.0.2"> + + <description>Apply an invert filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output invert jpeg + #else: + pil_filter.py $input $output invert ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Invert on ${input.display_name}"/> + </outputs> + + <help> + Invert the image (colours). + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-invert.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/max.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,34 @@ +<tool id="filter_max" name="Filter - Max" version="1.0.2"> + + <description>Apply a max filter of the given size.</description> + + <command interpreter="python"> + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output max $size jpeg + #else: + pil_filter.py $input $output max $size ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + <param name="size" size="3" type="integer" value="3" label="Max size" help="Max size in pixels." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Max ${size.value} on ${input.display_name}"/> + </outputs> + + <help> + Create a max filter of the given size. For each pixel in the input image, this filter copies the largest pixel value from a (size, size) environment to the output image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <param name="size" value="3" /> + <output name="output" file="images/sydney-max.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/median.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,34 @@ +<tool id="filter_median" name="Filter - Median" version="1.0.2"> + + <description>Apply a median filter of the given size.</description> + + <command interpreter="python"> + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output median $size jpeg + #else: + pil_filter.py $input $output median $size ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + <param name="size" size="3" type="integer" value="3" label="Median size" help="Median size in pixels." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Median ${size.value} on ${input.display_name}"/> + </outputs> + + <help> + Create a median filter of the given size. For each pixel in the input image, this filter copies the median pixel value from a (size, size) environment to the output image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <param name="size" value="3" /> + <output name="output" file="images/sydney-median.jpg" /> + </test> + </tests> + +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/min.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,34 @@ +<tool id="filter_min" name="Filter - Min" version="1.0.2"> + + <description>Apply a min filter of the given size.</description> + + <command interpreter="python"> + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output min $size jpeg + #else: + pil_filter.py $input $output min $size ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + <param name="size" size="3" type="integer" value="3" label="Min size" help="Min size in pixels." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Min ${size.value} on ${input.display_name}"/> + </outputs> + + <help> + Create a min filter of the given size. For each pixel in the input image, this filter copies the smallest pixel value from a (size, size) environment to the output image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <param name="size" value="3" /> + <output name="output" file="images/sydney-min.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/mode.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,34 @@ +<tool id="filter_mode" name="Filter - Mode" version="1.0.2"> + + <description>Apply a mode filter of the given size.</description> + + <command interpreter="python"> + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output mode $size jpeg + #else: + pil_filter.py $input $output mode $size ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + <param name="size" size="3" type="integer" value="3" label="Mode size" help="Mode size in pixels." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Mode ${size.value} on ${input.display_name}"/> + </outputs> + + <help> + Create a mode filter of the given size. For each pixel in the input image, this filter copies the most common pixel value in a (size, size) environment to the output image. If no pixel value occurs more than once, the original pixel value is used. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <param name="size" value="3" /> + <output name="output" file="images/sydney-mode.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/pil_filter.py Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,117 @@ +import Image +import ImageFilter +import ImageChops +import os +import sys + +def isodd(num): + return num & 1 and True or False + +def main(): + numArgs = len(sys.argv) + + if numArgs < 2: + print "USAGE: provide input, output, functions, parameters" + exit(1) + + listOfValues = sys.argv[1:] + + try: + imageIn = Image.open(listOfValues[0]) + except IOError: + print "cannot open: ", listOfValues[0] + + if listOfValues[2] == "median": + size = int(listOfValues[3]); + # prevent size to be even + if size & 1 == False: + size = size + 1 + imageMedian = imageIn.filter(ImageFilter.MedianFilter(size)) + imageOut = imageMedian.save(listOfValues[1], listOfValues[4]) + # imageMedian.show() + print "Applied a median filter of the given size." + elif listOfValues[2] == "emboss": + imageEmboss = imageIn.filter(ImageFilter.EMBOSS) + imageOut = imageEmboss.save(listOfValues[1], listOfValues[3]) + # imageEmboss.show() + print "Applied an emboss filter on the image." + elif listOfValues[2] == "blur": + imageBlur = imageIn.filter(ImageFilter.BLUR) + imageOut = imageBlur.save(listOfValues[1], listOfValues[3]) + # imageBlur.show() + print "Applied a blur filter on the image." + elif listOfValues[2] == "contour": + imageContour = imageIn.filter(ImageFilter.CONTOUR) + imageOut = imageContour.save(listOfValues[1], listOfValues[3]) + # imageContour.show() + print "Applied a contour filter on the image." + elif listOfValues[2] == "detail": + imageDetail = imageIn.filter(ImageFilter.DETAIL) + imageOut = imageDetail.save(listOfValues[1], listOfValues[3]) + # imageDetail.show() + print "Applied a detial filter on the image." + elif listOfValues[2] == "edge_enhance": + imageEdgeEnhance = imageIn.filter(ImageFilter.EDGE_ENHANCE) + imageOut = imageEdgeEnhance.save(listOfValues[1], listOfValues[3]) + # imageEdgeEnhance.show() + print "Applied an edge enhance filter on the image." + elif listOfValues[2] == "edge_enhance_more": + imageEdgeEnhanceMore = imageIn.filter(ImageFilter.EDGE_ENHANCE_MORE) + imageOut = imageEdgeEnhanceMore.save(listOfValues[1], listOfValues[3]) + # imageEdgeEnhanceMore.show() + print "Applied an eddge enhance more filter on the image." + elif listOfValues[2] == "find_edges": + imageFindEdges = imageIn.filter(ImageFilter.FIND_EDGES) + imageOut = imageFindEdges.save(listOfValues[1], listOfValues[3]) + # imageFindEdges.show() + print "Applied a find_edges filter on the image." + elif listOfValues[2] == "sharpen": + imageSharpen = imageIn.filter(ImageFilter.SHARPEN) + imageOut = imageSharpen.save(listOfValues[1], listOfValues[3]) + # imageSharpen.show() + print "Applied a sharpen filter on the image." + elif listOfValues[2] == "smooth": + imageSmooth = imageIn.filter(ImageFilter.SMOOTH) + imageOut = imageSmooth.save(listOfValues[1], listOfValues[3]) + # imageSmooth.show() + print "Applied a smooth filter on the image." + elif listOfValues[2] == "smooth_more": + imageSmoothMore = imageIn.filter(ImageFilter.SMOOTH_MORE) + imageOut = imageSmoothMore.save(listOfValues[1], listOfValues[3]) + # imageSmoothMore.show() + print "Applied a smooth_more filter on the image." + elif listOfValues[2] == "min": + size = int(listOfValues[3]) + # prevent size to be even + if size & 1 == False: + size = size + 1 + imageMin = imageIn.filter(ImageFilter.MinFilter(size)) + imageOut = imageMin.save(listOfValues[1], listOfValues[4]) + # imageMin.show() + print "Applied a min filter of the given size on the image" + elif listOfValues[2] == "max": + size = int(listOfValues[3]) + # prevent size to be even + if size & 1 == False: + size = size + 1 + imageMax = imageIn.filter(ImageFilter.MaxFilter(size)) + imageOut = imageMax.save(listOfValues[1], listOfValues[4]) + # imageMax.show() + print "Applied a max filter of the given size on the image" + elif listOfValues[2] == "mode": + size = int(listOfValues[3]) + # prevent size to be even + if size & 1 == False: + size = size + 1 + imageMode = imageIn.filter(ImageFilter.ModeFilter(size)) + imageOut = imageMode.save(listOfValues[1], listOfValues[4]) + # imageMode.show() + print "Applied a mode filter of the given size on the image" + elif listOfValues[2] == "invert": + imageInvert = ImageChops.invert(imageIn) + imageOut = imageInvert.save(listOfValues[1], listOfValues[3]) + # imageInvert.show() + print "Inverted the image." + +if __name__ == "__main__": + main() \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/sharpen.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_sharpen" name="Filter - Sharpen" version="1.0.2"> + + <description>Apply a sharpen filter on image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output sharpen jpeg + #else: + pil_filter.py $input $output sharpen ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Sharpen filter on ${input.display_name}"/> + </outputs> + + <help> + Apply a sharpen filter on the image. + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-sharpen.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/smooth.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_smooth" name="Filter - Smooth" version="1.0.2"> + + <description>Apply a smooth filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output smooth jpeg + #else: + pil_filter.py $input $output smooth ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Smooth filter on ${input.display_name}"/> + </outputs> + + <help> + Apply a smooth filter on the image (soften the image). + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-smoth.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/smooth_more.xml Mon Nov 25 21:12:30 2013 -0500 @@ -0,0 +1,32 @@ +<tool id="filter_smooth_more" name="Filter - Smooth More" version="1.0.2"> + + <description>Apply a smooth_more filter on the image.</description> + + <command interpreter="python" > + #if (str($input.ext) == 'jpg'): + pil_filter.py $input $output smooth_more jpeg + #else: + pil_filter.py $input $output smooth_more ${input.ext} + #end if + </command> + + <inputs> + <param name="input" type="data" format="png,jpg,tif,zip" label="Input image" help="Original RGB or grayscale image." /> + </inputs> + + <outputs> + <data format="input" name="output" metadata_source="input" label="Smooth more filter on ${input.display_name}"/> + </outputs> + + <help> + Apply a smooth_more filter on the image (soften the image). + </help> + + <tests> + <test> + <param name="input" value="images/sydney.jpg" /> + <output name="output" file="images/sydney-smoth-more.jpg" /> + </test> + </tests> + +</tool> \ No newline at end of file