summaryrefslogtreecommitdiff
path: root/megapixels/app/server/tasks/blur.py
diff options
context:
space:
mode:
Diffstat (limited to 'megapixels/app/server/tasks/blur.py')
-rw-r--r--megapixels/app/server/tasks/blur.py27
1 files changed, 11 insertions, 16 deletions
diff --git a/megapixels/app/server/tasks/blur.py b/megapixels/app/server/tasks/blur.py
index 3b7e20be..d1f67f54 100644
--- a/megapixels/app/server/tasks/blur.py
+++ b/megapixels/app/server/tasks/blur.py
@@ -16,18 +16,13 @@ celery_logger = get_task_logger(__name__)
import imutils
@celery.task(bind=True)
-def blur_task(self, uuid_name, extra):
+def blur_task(self, uuid_name, fn):
"""Process image and update during"""
celery_logger.debug('process_image_task, uuid: {}'.format(uuid_name))
files = []
- im = Image.open(os.path.join(upload_dir, uuid_name + '.jpg')).convert('RGB')
- im = im.resize((256,256))
- files.append({
- 'title': 'Original image',
- 'fn': upload_uri + uuid_name + '.jpg'
- })
+ im = Image.open(fn).convert('RGB')
self.update_state(
state = 'PROCESSING',
@@ -42,13 +37,13 @@ def blur_task(self, uuid_name, extra):
im_blur_pil = ensure_pil(im_blur)
fn = uuid_name + '_blur.jpg'
- fpath = os.path.join(render_dir, fn)
- im_blur_pil.save(fpath, 'JPEG', quality=95)
+ # fpath = os.path.join(render_dir, fn)
+ # im_blur_pil.save(fpath, 'JPEG', quality=95)
- files.append({
- 'title': 'Blurred image',
- 'fn': render_uri + uuid_name + '_blur.jpg'
- })
+ # files.append({
+ # 'title': 'Blurred image',
+ # 'fn': render_uri + uuid_name + '_blur.jpg'
+ # })
time.sleep(3)
@@ -67,9 +62,9 @@ def blur_task(self, uuid_name, extra):
'files': files
}
- json_path = os.path.join(json_dir, uuid_name + '.json')
- with open(json_path, 'w') as json_file:
- json.dump(data, json_file)
+ # json_path = os.path.join(json_dir, uuid_name + '.json')
+ # with open(json_path, 'w') as json_file:
+ # json.dump(data, json_file)
celery_logger.debug('ok')