Browse Source

Merge branch 'dev' of private repo into dev

nagadomi 9 years ago
parent
commit
edfaafcf9e

+ 2 - 0
appendix/waifu2x.nginx.conf

@@ -11,6 +11,8 @@ map $http_accept_language $lang {
   ~pt pt;
   ~es es;
   ~fr fr;
+  ~de de;
+  ~tr tr;
   ~en en;
 }
 

+ 168 - 0
assets/index.de.html

@@ -0,0 +1,168 @@
+<!DOCTYPE html> 
+<html lang="de">
+  <!-- This file was automatically generated by webgen/gen.rb. Do not make changes to this file manually. -->
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <meta charset="utf-8">
+    <link rel="shortcut icon" href="favicon.ico"/>
+    <meta name="viewport" content="initial-scale=1.0,width=device-width">
+    <link href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css" rel="stylesheet" type="text/css">
+    <link href="style.css" rel="stylesheet" type="text/css">
+    <link href="mobile.css" rel="stylesheet" type="text/css" media="screen and (max-width: 768px) and (min-width: 0px)">
+    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
+    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
+    <script type="text/javascript" src="ui.js"></script>
+    <title>waifu2x</title>
+  </head>
+  <body>
+    <div class="all-page">
+      <h1 class="main-title">waifu2x</h1>
+      <div class="choose-lang">
+	<a href="index.html">
+	  English
+	</a>
+	/
+	<a href="index.ja.html">
+	  日本語
+	</a>
+	/
+	<a href="index.ru.html">
+	  Русский
+	</a>
+	/
+	<a href="index.pt.html">
+	  Português
+	</a>
+	/
+	<a href="index.es.html">
+	  Español
+	</a>
+	/
+	<a href="index.fr.html">
+	  Français
+	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
+      </div>
+      <p>Einzelbild Super-Auflösungs Konvertierung für Bilder im Anime Stil mithilfe eines faltenden neuralen Netzwerks. Zusätzlich dazu unterstützt es auch Fotos.</p>
+      <p class="margin1 link-box">
+	<a href="https://raw.githubusercontent.com/nagadomi/waifu2x/master/images/slide.png" class="blue-link" target="_blank">
+	  Zeige die volle Demonstration an
+	</a>
+	| 
+	<a href="https://github.com/nagadomi/waifu2x" class="blue-link" target="_blank">
+	  Gehe zu GitHub
+	</a>
+      </p>
+      <form action="/api" method="POST" enctype="multipart/form-data" target="_blank">
+	<div class="option-box first">
+	  <div class="option-left">Bildauswahl:</div>
+	  <div class="option-right">
+	    <input type="text" id="url" name="url" placeholder="URL hier eintragen">
+	    <div class="option-right-small">
+	      Oder wählen Sie eine Datei aus: 
+	      <input type="file" id="file" name="file"></div>
+	  </div>
+	  <div class="option-hint">
+	    Beschränkungen: Größe: 3MB, Rauschunterdrückung: 2560x2560px, maximale Hochskalierung: 1280x1280px.
+	  </div>
+	</div>
+	<div class="option-box">
+	  <div class="option-left">
+	    Stil:
+	  </div>
+	  <div class="option-right">
+	    <label><input type="radio" name="style" class="radio" value="art" checked>
+	      <span class="r-text">
+		Kunst
+	      </span>
+	    </label>
+	    <label><input type="radio" name="style" class="radio" value="photo">
+	      <span class="r-text">
+		Foto
+	      </span>
+	    </label>
+	  </div>
+	</div>
+	<div class="option-box">
+	  <div class="option-left">
+	    Rauschunterdrückung:
+	    <div class="option-left-small">
+	      (verursacht möglicherweise JPEG Artifakte)
+	    </div>
+	  </div>
+	  <div class="option-right">
+	    <label><input type="radio" name="noise" class="radio" value="0">
+	      <span class="r-text">
+		Keine
+	      </span>
+	    </label>
+	    <label><input type="radio" name="noise" class="radio" value="1" checked>
+	      <span class="r-text">
+		Mittel
+	      </span>
+	    </label>
+	    <label>
+	      <input type="radio" name="noise" class="radio" value="2">
+	      <span class="r-text">
+		Hoch
+	      </span>
+	    </label>
+	    <label>
+	      <input type="radio" name="noise" class="radio" value="3">
+	      <span class="r-text">
+		Am Höchsten
+	      </span>
+	    </label>
+	  </div>
+	  <div class="option-hint">
+	    Sie sollten Rauschunterdrückung nutzen, wenn das Bild an sich viel Bildrauschen aufweist. Ansonsten könnte es den entgegensetzten Effekt haben.
+	  </div>
+	</div>
+	<div class="option-box">
+	  <div class="option-left">
+	    Hochskalierung:
+	    <div class="option-left-small"></div>
+	  </div>
+	  <div class="option-right">
+	    <label><input type="radio" name="scale" class="radio" value="0" checked>
+	      <span class="r-text">
+		Keine
+	      </span>
+	    </label>
+	    <label><input type="radio" name="scale" class="radio" value="1">
+	      <span class="r-text">
+		1.6x
+	      </span>
+	    </label>
+	    <label><input type="radio" name="scale" class="radio" value="2">
+	      <span class="r-text">
+		2x
+	      </span>
+	    </label>
+	  </div>
+	</div>
+	
+	  <input type="submit" class="button" value="Konvertieren">
+	
+	<input type="submit" name="download" value="Herunterladen" class="button">
+	<div class="bottom-hint">
+	  <ul>
+	    
+	      <li>Wenn Sie Firefox benutzen, benutzen Sie bitte SRTG+S um das Bild zu speichern. Herunterladen funktioniert bei Firefox leider nicht.</li>
+	    
+	  </ul>
+	</div>
+      </form>
+    </div>
+    <div class="bottom-info address">
+      <a href="https://github.com/nagadomi/waifu2x" class="gray-link" target="_blank">waifu2x</a>
+    </div>
+  </body>
+</html>

+ 8 - 0
assets/index.es.html

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p>Mejora la resolución de ilustraciones de tipo anime utilizando redes neuronales convolucionales. También es compatible con fotografías.</p>
       <p class="margin1 link-box">

+ 8 - 0
assets/index.fr.html

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p>Outil d'agrandissement de dessins de style anime, employant des réseaux de neurones convolutionnels. Fonctionne aussi sur des photos.</p>
       <p class="margin1 link-box">

+ 8 - 0
assets/index.html

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p>Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo.</p>
       <p class="margin1 link-box">

+ 8 - 0
assets/index.ja.html

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p>深層畳み込みニューラルネットワークによる二次元画像のための超解像システム。 写真にも対応。</p>
       <p class="margin1 link-box">

+ 8 - 0
assets/index.pt.html

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p>Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo.</p>
       <p class="margin1 link-box">

+ 9 - 1
assets/index.ru.html

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p>Waifu2x позволяет увеличивать в 4 раза рисованные изображения, например аниме или арт, а также устранять шум на изображении (преимущественно артефакты сжатия JPEG). Теперь также поддерживаются фотографии.</p>
       <p class="margin1 link-box">
@@ -109,7 +117,7 @@
 	    <label>
 	      <input type="radio" name="noise" class="radio" value="3">
 	      <span class="r-text">
-		Highest
+		Очень сильно
 	      </span>
 	    </label>
 	  </div>

+ 168 - 0
assets/index.tr.html

@@ -0,0 +1,168 @@
+<!DOCTYPE html> 
+<html lang="tr">
+  <!-- This file was automatically generated by webgen/gen.rb. Do not make changes to this file manually. -->
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <meta charset="utf-8">
+    <link rel="shortcut icon" href="favicon.ico"/>
+    <meta name="viewport" content="initial-scale=1.0,width=device-width">
+    <link href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css" rel="stylesheet" type="text/css">
+    <link href="style.css" rel="stylesheet" type="text/css">
+    <link href="mobile.css" rel="stylesheet" type="text/css" media="screen and (max-width: 768px) and (min-width: 0px)">
+    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
+    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
+    <script type="text/javascript" src="ui.js"></script>
+    <title>waifu2x</title>
+  </head>
+  <body>
+    <div class="all-page">
+      <h1 class="main-title">waifu2x</h1>
+      <div class="choose-lang">
+	<a href="index.html">
+	  English
+	</a>
+	/
+	<a href="index.ja.html">
+	  日本語
+	</a>
+	/
+	<a href="index.ru.html">
+	  Русский
+	</a>
+	/
+	<a href="index.pt.html">
+	  Português
+	</a>
+	/
+	<a href="index.es.html">
+	  Español
+	</a>
+	/
+	<a href="index.fr.html">
+	  Français
+	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
+      </div>
+      <p>Derin Sarmalı Sinirsel Ağ ile çalışan anime stili çalışmalar için süper çözünürlük yükselticidir. Normal fotoğrafları da destekler.</p>
+      <p class="margin1 link-box">
+	<a href="https://raw.githubusercontent.com/nagadomi/waifu2x/master/images/slide.png" class="blue-link" target="_blank">
+	  Bütün ispatı göster
+	</a>
+	| 
+	<a href="https://github.com/nagadomi/waifu2x" class="blue-link" target="_blank">
+	  Github'a Git
+	</a>
+      </p>
+      <form action="/api" method="POST" enctype="multipart/form-data" target="_blank">
+	<div class="option-box first">
+	  <div class="option-left">Resim seç:</div>
+	  <div class="option-right">
+	    <input type="text" id="url" name="url" placeholder="Adres Girin">
+	    <div class="option-right-small">
+	      Veya bir dosya seçin: 
+	      <input type="file" id="file" name="file"></div>
+	  </div>
+	  <div class="option-hint">
+	    Limitler: Boyut: 3MB, Gürültü Azaltma: 2560x2560px, Çözünürlük Yükseltme: 1280x1280px.
+	  </div>
+	</div>
+	<div class="option-box">
+	  <div class="option-left">
+	    Stil:
+	  </div>
+	  <div class="option-right">
+	    <label><input type="radio" name="style" class="radio" value="art" checked>
+	      <span class="r-text">
+		Dijital Çizim
+	      </span>
+	    </label>
+	    <label><input type="radio" name="style" class="radio" value="photo">
+	      <span class="r-text">
+		Fotoğraf
+	      </span>
+	    </label>
+	  </div>
+	</div>
+	<div class="option-box">
+	  <div class="option-left">
+	    Gürültü Azaltma:
+	    <div class="option-left-small">
+	      (sonuç JPEG olarak çıkabilir)
+	    </div>
+	  </div>
+	  <div class="option-right">
+	    <label><input type="radio" name="noise" class="radio" value="0">
+	      <span class="r-text">
+		Yok
+	      </span>
+	    </label>
+	    <label><input type="radio" name="noise" class="radio" value="1" checked>
+	      <span class="r-text">
+		Orta
+	      </span>
+	    </label>
+	    <label>
+	      <input type="radio" name="noise" class="radio" value="2">
+	      <span class="r-text">
+		Yüksek
+	      </span>
+	    </label>
+	    <label>
+	      <input type="radio" name="noise" class="radio" value="3">
+	      <span class="r-text">
+		En Yüksek
+	      </span>
+	    </label>
+	  </div>
+	  <div class="option-hint">
+	    Resimde gürültü varsa gürültü azaltmayı kullanmanızı tavsiye ederiz, yoksa tam tersi etkiler bulunabilir.
+	  </div>
+	</div>
+	<div class="option-box">
+	  <div class="option-left">
+	    Çözünürlük Yükseltme:
+	    <div class="option-left-small"></div>
+	  </div>
+	  <div class="option-right">
+	    <label><input type="radio" name="scale" class="radio" value="0" checked>
+	      <span class="r-text">
+		Yok
+	      </span>
+	    </label>
+	    <label><input type="radio" name="scale" class="radio" value="1">
+	      <span class="r-text">
+		1.6x
+	      </span>
+	    </label>
+	    <label><input type="radio" name="scale" class="radio" value="2">
+	      <span class="r-text">
+		2x
+	      </span>
+	    </label>
+	  </div>
+	</div>
+	
+	  <input type="submit" class="button" value="Başlat">
+	
+	<input type="submit" name="download" value="İndir" class="button">
+	<div class="bottom-hint">
+	  <ul>
+	    
+	      <li>Firefox kullanıyorsanız, lütfen CTRL+S tuşu ile resmi indirin. "Resmi Kaydet" opsiyonu çalışmaz.</li>
+	    
+	  </ul>
+	</div>
+      </form>
+    </div>
+    <div class="bottom-info address">
+      <a href="https://github.com/nagadomi/waifu2x" class="gray-link" target="_blank">waifu2x</a>
+    </div>
+  </body>
+</html>

+ 2 - 2
convert_data.lua

@@ -33,8 +33,8 @@ local function load_images(list)
    local x = {}
    for i = 1, #lines do
       local line = lines[i]
-      local im, alpha = image_loader.load_byte(line)
-      if alpha then
+      local im, meta = image_loader.load_byte(line)
+      if meta and meta.alpha then
 	 io.stderr:write(string.format("\n%s: skip: image has alpha channel.\n", line))
       else
 	 if settings.max_training_image_size > 0 then

+ 27 - 26
lib/image_loader.lua

@@ -9,14 +9,15 @@ local clip_eps8 = (1.0 / 255.0) * 0.5 - (1.0e-7 * (1.0 / 255.0) * 0.5)
 local clip_eps16 = (1.0 / 65535.0) * 0.5 - (1.0e-7 * (1.0 / 65535.0) * 0.5)
 local background_color = 0.5
 
-function image_loader.encode_png(rgb, depth, inplace)
-   if inplace == nil then
-      inplace = false
+function image_loader.encode_png(rgb, options)
+   options = options or {}
+   options.depth = options.depth or 8
+   if options.inplace == nil then
+      options.inplace = false
    end
-   depth = depth or 8
    rgb = iproc.byte2float(rgb)
-   if depth < 16 then
-      if inplace then
+   if options.depth < 16 then
+      if options.inplace then
 	 rgb:add(clip_eps8)
       else
 	 rgb = rgb:clone():add(clip_eps8)
@@ -25,7 +26,7 @@ function image_loader.encode_png(rgb, depth, inplace)
       rgb[torch.gt(rgb, 1.0)] = 1.0
       rgb = rgb:mul(255):floor():div(255)
    else
-      if inplace then
+      if options.inplace then
 	 rgb:add(clip_eps16)
       else
 	 rgb = rgb:clone():add(clip_eps16)
@@ -43,10 +44,13 @@ function image_loader.encode_png(rgb, depth, inplace)
       im = gm.Image(rgb, "I", "DHW")
       -- im:colorspace("GRAY") -- it does not work
    end
-   return im:depth(depth):format("PNG"):toString(9)
+   if options.gamma then
+      im:gamma(options.gamma)
+   end
+   return im:depth(options.depth):format("PNG"):toString(9)
 end
-function image_loader.save_png(filename, rgb, depth, inplace)
-   local blob = image_loader.encode_png(rgb, depth, inplace)
+function image_loader.save_png(filename, rgb, options)
+   local blob = image_loader.encode_png(rgb, options)
    local fp = io.open(filename, "wb")
    if not fp then
       error("IO error: " .. filename)
@@ -57,8 +61,8 @@ function image_loader.save_png(filename, rgb, depth, inplace)
 end
 function image_loader.decode_float(blob)
    local load_image = function()
+      local meta = {}
       local im = gm.Image()
-      local alpha = nil
       local gamma_lcd = 0.454545
       
       im:fromBlob(blob, #blob)
@@ -66,12 +70,8 @@ function image_loader.decode_float(blob)
       if im:colorspace() == "CMYK" then
 	 im:colorspace("RGB")
       end
-      local gamma = math.floor(im:gamma() * 1000000) / 1000000
-      if gamma ~= 0 and gamma ~= gamma_lcd then
-	 local cg = gamma / gamma_lcd
-	 im:gammaCorrection(cg, "Red")
-	 im:gammaCorrection(cg, "Blue")
-	 im:gammaCorrection(cg, "Green")
+      if gamma ~= 0 and math.floor(im:gamma() * 1000000) / 1000000 ~= gamma_lcd then
+	 meta.gamma = im:gamma()
       end
       -- FIXME: How to detect that a image has an alpha channel?
       if blob:sub(1, 4) == "\x89PNG" or blob:sub(1, 3) == "GIF" then
@@ -79,9 +79,9 @@ function image_loader.decode_float(blob)
 	 im = im:toTensor('float', 'RGBA', 'DHW')
 	 local sum_alpha = (im[4] - 1.0):sum()
 	 if sum_alpha < 0 then
-	    alpha = im[4]:reshape(1, im:size(2), im:size(3))
+	    meta.alpha = im[4]:reshape(1, im:size(2), im:size(3))
 	    -- drop full transparent background
-	    local mask = torch.le(alpha, 0.0)
+	    local mask = torch.le(meta.alpha, 0.0)
 	    im[1][mask] = background_color
 	    im[2][mask] = background_color
 	    im[3][mask] = background_color
@@ -94,25 +94,26 @@ function image_loader.decode_float(blob)
       else
 	 im = im:toTensor('float', 'RGB', 'DHW')
       end
-      return {im, alpha, blob}
+      meta.blob = blob
+      return {im, meta}
    end
    local state, ret = pcall(load_image)
    if state then
-      return ret[1], ret[2], ret[3]
+      return ret[1], ret[2]
    else
-      return nil, nil, nil
+      return nil, nil
    end
 end
 function image_loader.decode_byte(blob)
-   local im, alpha
-   im, alpha, blob = image_loader.decode_float(blob)
+   local im, meta
+   im, meta = image_loader.decode_float(blob)
    
    if im then
       im = iproc.float2byte(im)
       -- hmm, alpha does not convert here
-      return im, alpha, blob
+      return im, meta
    else
-      return nil, nil, nil
+      return nil, nil
    end
 end
 function image_loader.load_float(file)

+ 7 - 4
waifu2x.lua

@@ -11,7 +11,8 @@ local alpha_util = require 'alpha_util'
 torch.setdefaulttensortype('torch.FloatTensor')
 
 local function convert_image(opt)
-   local x, alpha = image_loader.load_float(opt.i)
+   local x, meta = image_loader.load_float(opt.i)
+   local alpha = meta.alpha
    local new_x = nil
    local t = sys.clock()
    local scale_f, image_f
@@ -65,7 +66,7 @@ local function convert_image(opt)
    else
       error("undefined method:" .. opt.method)
    end
-   image_loader.save_png(opt.o, new_x, opt.depth, true)
+   image_loader.save_png(opt.o, new_x, {depth = opt.depth, inplace = true, gamma = meta.gamma})
    print(opt.o .. ": " .. (sys.clock() - t) .. " sec")
 end
 local function convert_frames(opt)
@@ -115,7 +116,8 @@ local function convert_frames(opt)
    fp:close()
    for i = 1, #lines do
       if opt.resume == 0 or path.exists(string.format(opt.o, i)) == false then
-	 local x, alpha = image_loader.load_float(lines[i])
+	 local x, meta = image_loader.load_float(lines[i])
+	 local alpha = meta.alpha
 	 local new_x = nil
 	 if opt.m == "noise" then
 	    new_x = image_f(noise_model[opt.noise_level], x, opt.crop_size)
@@ -141,7 +143,8 @@ local function convert_frames(opt)
 	 else
 	    output = string.format(opt.o, i)
 	 end
-	 image_loader.save_png(output, new_x, opt.depth, true)
+	 image_loader.save_png(output, new_x, 
+			       {depth = opt.depth, inplace = true, gamma = meta.gamma})
 	 xlua.progress(i, #lines)
 	 if i % 10 == 0 then
 	    collectgarbage()

+ 31 - 23
web.lua

@@ -93,7 +93,7 @@ local function cache_url(url)
 	 end
       end
    end
-   return nil, nil, nil
+   return nil, nil
 end
 local function get_image(req)
    local file_info = req:get_arguments("file")
@@ -108,22 +108,23 @@ local function get_image(req)
       end
    end
    if file and file:len() > 0 then
-      local x, alpha, blob = image_loader.decode_float(file)
-      return x, alpha, blob, filename
+      local x, meta = image_loader.decode_float(file)
+      return x, meta, filename
    elseif url and url:len() > 0 then
-      local x, alpha, blob = cache_url(url)
-      return x, alpha, blob, filename
+      local x, meta = cache_url(url)
+      return x, meta, filename
    end
-   return nil, nil, nil, nil
+   return nil, nil, nil
 end
 local function cleanup_model(model)
    if CLEANUP_MODEL then
       model:clearState() -- release GPU memory
    end
 end
-local function convert(x, alpha, options)
+local function convert(x, meta, options)
    local cache_file = path.join(CACHE_DIR, options.prefix .. ".png")
    local alpha_cache_file = path.join(CACHE_DIR, options.alpha_prefix .. ".png")
+   local alpha = meta.alpha
    local alpha_orig = alpha
 
    if path.exists(alpha_cache_file) then
@@ -137,7 +138,7 @@ local function convert(x, alpha, options)
    end
    if path.exists(cache_file) then
       x = image_loader.load_float(cache_file)
-      return x, alpha
+      return x, {alpha = alpha, gamma = meta.gamma, blob = meta.blob}
    else
       if options.style == "art" then
 	 if options.border then
@@ -192,7 +193,7 @@ local function convert(x, alpha, options)
       end
       image_loader.save_png(cache_file, x)
 
-      return x, alpha
+      return x, {alpha = alpha, gamma = meta.gamma, blob = meta.blob}
    end
 end
 local function client_disconnected(handler)
@@ -218,7 +219,7 @@ function APIHandler:post()
       self:write("client disconnected")
       return
    end
-   local x, alpha, blob, filename = get_image(self)
+   local x, meta, filename = get_image(self)
    local scale = tonumber(self:get_argument("scale", "0"))
    local noise = tonumber(self:get_argument("noise", "0"))
    local style = self:get_argument("style", "art")
@@ -230,29 +231,29 @@ function APIHandler:post()
    if x and valid_size(x, scale) then
       local prefix = nil
       if (noise ~= 0 or scale ~= 0) then
-	 local hash = md5.sumhexa(blob)
+	 local hash = md5.sumhexa(meta.blob)
 	 local alpha_prefix = style .. "_" .. hash .. "_alpha"
 	 local border = false
-	 if scale ~= 0 and alpha then
+	 if scale ~= 0 and meta.alpha then
 	    border = true
 	 end
 	 if noise == 1 then
 	    prefix = style .. "_noise1_"
-	    x = convert(x, alpha, {method = "noise1", style = style,
-				   prefix = prefix .. hash,
-				   alpha_prefix = alpha_prefix, border = border})
+	    x = convert(x, meta, {method = "noise1", style = style,
+				  prefix = prefix .. hash,
+				  alpha_prefix = alpha_prefix, border = border})
 	    border = false
 	 elseif noise == 2 then
 	    prefix = style .. "_noise2_"
-	    x = convert(x, alpha, {method = "noise2", style = style,
-				   prefix = prefix .. hash, 
-				   alpha_prefix = alpha_prefix, border = border})
+	    x = convert(x, meta, {method = "noise2", style = style,
+				  prefix = prefix .. hash, 
+				  alpha_prefix = alpha_prefix, border = border})
 	    border = false
 	 elseif noise == 3 then
 	    prefix = style .. "_noise3_"
-	    x = convert(x, alpha, {method = "noise3", style = style,
-				   prefix = prefix .. hash, 
-				   alpha_prefix = alpha_prefix, border = border})
+	    x = convert(x, meta, {method = "noise3", style = style,
+				  prefix = prefix .. hash, 
+				  alpha_prefix = alpha_prefix, border = border})
 	    border = false
 	 end
 	 if scale == 1 or scale == 2 then
@@ -265,7 +266,7 @@ function APIHandler:post()
 	    else
 	       prefix = style .. "_scale_"
 	    end
-	    x, alpha = convert(x, alpha, {method = "scale", style = style, prefix = prefix .. hash, alpha_prefix = alpha_prefix, border = border})
+	    x, meta = convert(x, meta, {method = "scale", style = style, prefix = prefix .. hash, alpha_prefix = alpha_prefix, border = border})
 	    if scale == 1 then
 	       x = iproc.scale(x, x:size(3) * (1.6 / 2.0), x:size(2) * (1.6 / 2.0), "Sinc")
 	    end
@@ -281,7 +282,8 @@ function APIHandler:post()
       else
 	 name = uuid() .. ".png"
       end
-      local blob = image_loader.encode_png(alpha_util.composite(x, alpha), 8, true)
+      local blob = image_loader.encode_png(alpha_util.composite(x, meta.alpha),
+					   { depth = 8, inplace = true, gamma = meta.gamma})
 
       self:set_header("Content-Length", string.format("%d", #blob))
       if download > 0 then
@@ -309,6 +311,8 @@ local index_ru = file.read(path.join(ROOT, "assets", "index.ru.html"))
 local index_pt = file.read(path.join(ROOT, "assets", "index.pt.html"))
 local index_es = file.read(path.join(ROOT, "assets", "index.es.html"))
 local index_fr = file.read(path.join(ROOT, "assets", "index.fr.html"))
+local index_de = file.read(path.join(ROOT, "assets", "index.de.html"))
+local index_tr = file.read(path.join(ROOT, "assets", "index.tr.html"))
 local index_en = file.read(path.join(ROOT, "assets", "index.html"))
 function FormHandler:get()
    local lang = self.request.headers:get("Accept-Language")
@@ -327,6 +331,10 @@ function FormHandler:get()
 	 self:write(index_es)
       elseif langs[1] == "fr" then
 	 self:write(index_fr)
+      elseif langs[1] == "de" then
+	 self:write(index_de)
+      elseif langs[1] == "tr" then
+	 self:write(index_tr)
       else
 	 self:write(index_en)
       end

+ 25 - 0
webgen/locales/de.yml

@@ -0,0 +1,25 @@
+---
+description: Einzelbild Super-Auflösungs Konvertierung für Bilder im Anime Stil mithilfe eines faltenden neuralen Netzwerks. Zusätzlich dazu unterstützt es auch Fotos.
+show_demonstration: Zeige die volle Demonstration an
+go_to_github: Gehe zu GitHub
+image_choosing: Bildauswahl
+type_url: URL hier eintragen
+choose_file: Oder wählen Sie eine Datei aus
+file_limits: "Beschränkungen: Größe: 3MB, Rauschunterdrückung: 2560x2560px, maximale Hochskalierung: 1280x1280px."
+style: Stil
+artwork: Kunst
+photo: Foto
+noise_reduction: Rauschunterdrückung
+expect_jpeg: verursacht möglicherweise JPEG Artifakte
+nr_none: Keine
+nr_medium: Mittel
+nr_high: Hoch
+nr_highest: Am Höchsten
+nr_hint: "Sie sollten Rauschunterdrückung nutzen, wenn das Bild an sich viel Bildrauschen aufweist. Ansonsten könnte es den entgegensetzten Effekt haben."
+upscaling: Hochskalierung
+up_none: Keine
+button_convert: Konvertieren
+button_download: Herunterladen
+hints:
+  - "Wenn Sie Firefox benutzen, benutzen Sie bitte SRTG+S um das Bild zu speichern. Herunterladen funktioniert bei Firefox leider nicht."
+  

+ 1 - 0
webgen/locales/ru.yml

@@ -14,6 +14,7 @@ expect_jpeg: артефактов JPEG
 nr_none: Нет
 nr_medium: Средне
 nr_high: Сильно
+nr_highest: Очень сильно
 nr_hint: "Устранение шума нужно использовать, если на картинке действительно есть шум, иначе это даст противоположный эффект."
 upscaling: Апскейл
 up_none: Нет

+ 24 - 0
webgen/locales/tr.yml

@@ -0,0 +1,24 @@
+---
+description: Derin Sarmalı Sinirsel Ağ ile çalışan anime stili çalışmalar için süper çözünürlük yükselticidir. Normal fotoğrafları da destekler.
+show_demonstration: Bütün ispatı göster
+go_to_github: "Github'a Git"
+image_choosing: Resim seç
+type_url: Adres Girin
+choose_file: Veya bir dosya seçin
+file_limits: "Limitler: Boyut: 3MB, Gürültü Azaltma: 2560x2560px, Çözünürlük Yükseltme: 1280x1280px."
+style: Stil
+artwork: Dijital Çizim
+photo: Fotoğraf
+noise_reduction: Gürültü Azaltma
+expect_jpeg: sonuç JPEG olarak çıkabilir
+nr_none: Yok
+nr_medium: Orta
+nr_high: Yüksek
+nr_highest: En Yüksek
+nr_hint: "Resimde gürültü varsa gürültü azaltmayı kullanmanızı tavsiye ederiz, yoksa tam tersi etkiler bulunabilir."
+upscaling: Çözünürlük Yükseltme
+up_none: Yok
+button_convert: Başlat
+button_download: İndir
+hints:
+  - "Firefox kullanıyorsanız, lütfen CTRL+S tuşu ile resmi indirin. \"Resmi Kaydet\" opsiyonu çalışmaz."

+ 8 - 0
webgen/templates/index.html.erb

@@ -41,6 +41,14 @@
 	<a href="index.fr.html">
 	  Français
 	</a>
+	/
+	<a href="index.de.html">
+	  Deutsch
+	</a>
+	/
+	<a href="index.tr.html">
+	  Türkçe
+	</a>
       </div>
       <p><%= t[:description] %></p>
       <p class="margin1 link-box">