aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2014-02-28 01:06:15 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2014-02-28 01:06:15 -0500
commit9c1b4277504a4ad65fd6705ffbf1089af28b322d (patch)
tree400b957fef3c7ab18382a6f0f4eb45942b4f0a84
parentebd5024ec7e47ac85a41bf4d1ff98df15eb8cac3 (diff)
downloadocr-layer-curation-9c1b4277504a4ad65fd6705ffbf1089af28b322d.tar.gz
serve jpeg images
-rw-r--r--web/main.py6
-rw-r--r--web/templates/index.html2
2 files changed, 4 insertions, 4 deletions
diff --git a/web/main.py b/web/main.py
index 81e8252..b93f2e4 100644
--- a/web/main.py
+++ b/web/main.py
@@ -17,16 +17,16 @@ class ImageHandler(RequestHandler):
def get(self, page_number):
im = image_from_book("../Villiers_de_L'Isle-Adam_-_Tribulat_Bonhomet,_1908.djvu", int(page_number))
- self.set_header('Content-Type', 'image/png')
+ self.set_header('Content-Type', 'image/jpg')
img_buff = io.BytesIO()
- im.save(img_buff, format="PNG")
+ im.save(img_buff, format="JPEG")
img_buff.seek(0)
self.write(img_buff.read())
self.finish()
application = Application([
(r'/(\d+)/?', MainHandler),
- (r'/(\d+)\.png/?', ImageHandler)]
+ (r'/(\d+)\.jpg/?', ImageHandler)]
, **settings)
if __name__ == '__main__':
diff --git a/web/templates/index.html b/web/templates/index.html
index a3dec33..b3b5fe0 100644
--- a/web/templates/index.html
+++ b/web/templates/index.html
@@ -2,7 +2,7 @@
{% block main %}
<div id="image_container">
- <img id="page" src="{{page_number}}.png" usemap="#wordmap" />
+ <img id="page" src="{{page_number}}.jpg" usemap="#wordmap" />
</div>
<map name="wordmap">{% for id, coords in areas %}
<area href="#" shape="rect" coords="{{coords}}" data-id="{{id}}" />{% end %}