changeset 158:86a5b3c4af4b

removed scaleTest.py
author casties
date Thu, 06 Jun 2013 14:00:31 +0200
parents 2e0953694aef
children ee79f6ba8d01
files scaleTest.py
diffstat 1 files changed, 0 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/scaleTest.py	Thu Jun 06 11:33:17 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-from PIL import Image;
-from cStringIO import  StringIO;
-import ImageFilter
-
-import urllib
-import logging
-
-
-url="http://localhost:18080/www/projects/DEPT1_710Schemmel-Space/Gruppe_Schemmel.jpg"
-ul = urllib.urlopen(url)
-datStringIO = StringIO(ul.read());
-
-
-try:
-    pilImg = Image.open(datStringIO)
-   
-   
-except:
-     logging.error("scale image input:"+self.getId())
-     
-    
-w,h = pilImg.size
-logging.debug("oldsize: %s %s"%(w,h))
-targetW=120.
-targetH=75.
-
-
-facW=targetW/w 
-
-h1 = int(h*facW)
-
-if h1<targetH: #bild zu klein in h
-    facH=targetH/h
-    
-    w1=int(w*facH)
-     
-    fs = min(max(int(1/facH)+1,3),10)
-    #fs = 5
-    logging.debug(fs)
-    print facH
-    if (1/facH) > 2:
-            pilImg = pilImg.filter(ImageFilter.BLUR)
- 
-    try:
-        pilImg = pilImg.filter(ImageFilter.MaxFilter(fs))
-    except:
-        pilImg = pilImg.filter(ImageFilter.MaxFilter(fs-1))
-   
-    logging.debug("Xnew size: %s %s"%(w1,targetH))
-    res = pilImg.resize((w1,int(targetH)),Image.ANTIALIAS);
-    
-    
-else:
-    fs = min(max(int(1/facW)+1,3),10)
-    #fs=5
-    logging.debug(fs)
-    
-    print facW
-    if (1/facW) > 2:
-        pilImg = pilImg.filter(ImageFilter.BLUR)
-        
-    try:
-        pilImg = pilImg.filter(ImageFilter.MaxFilter(fs))
-    except:
-        
-        
-        try:
-            pilImg = pilImg.filter(ImageFilter.MaxFilter(fs-1))
-        except:
-            pass
-    logging.debug("ynew size: %s %s"%(targetW,h1))
-    res = pilImg.resize((int(targetW),h1))
-    
-nw,nh = res.size
-   
-cutW1=int(nw/2-(targetW/2))  
-cutW2=int(nw/2+(targetW/2))   
-
-cutH1=int(nh/2-(targetH/2))   
-cutH2=int(nh/2+(targetH/2))    
-
-
-
-res2 = res.crop((cutW1,cutH1,cutW2,cutH2))
-
-outS =  StringIO()
-
-res2.save("/tmp/test.jpg")
-