def call_merge_images(): ''' Merges two images into a third one Accepts merge_type as an optional parameter, see here for valid merge types: http://www.effbot.org/imagingbook/imagechops.htm ''' try: args_dict = gather_and_enforce_request_args([{'name': 'img1_id', 'required': True}, {'name': 'img2_id', 'required': True}, {'name': 'merge_type'}]) img1_id = args_dict['img1_id'] img2_id = args_dict['img2_id'] test_input_parameters_for_valid_image_ids(args_dict) merge_type = check_for_merge_type(args_dict) result_id = cast_uuid_to_string(uuid.uuid4()) merge_images_task.delay( img1_primary_id_in=img1_id, img1_alternate_id_in=uuid.uuid4(), img2_id_in=img2_id, img_id_out=result_id, group_id='current', merge_type=merge_type) accept_json = {'result_id': result_id} return Response(json.dumps(accept_json), status=202, mimetype='application/json') except Exception as e: return Response(json.dumps(e.message), status=e.status_code, mimetype='application/json')
def call_merge_images(): (img1_id, img2_id, result_id) = (None, None, None) if request.args.has_key('img1_id'): img1_id = request.args.get('img1_id') if request.args.has_key('img2_id'): img2_id = request.args.get('img2_id') if request.args.has_key('result_id'): result_id = request.args.get('result_id') if img1_id and img2_id and result_id: merge_images_task.delay( img1_primary_id_in=img1_id, img1_alternate_id_in=uuid.uuid4(), img2_id_in=img2_id, img_id_out=result_id, group_id='current' ) return Response(json.dumps('request accepted'), status=202, mimetype='application/json')
def call_merge_images(): (img1_id, img2_id, result_id) = (None, None, None) if request.args.has_key('img1_id'): img1_id = request.args.get('img1_id') if request.args.has_key('img2_id'): img2_id = request.args.get('img2_id') if request.args.has_key('result_id'): result_id = request.args.get('result_id') if img1_id and img2_id and result_id: merge_images_task.delay(img1_primary_id_in=img1_id, img1_alternate_id_in=uuid.uuid4(), img2_id_in=img2_id, img_id_out=result_id, group_id='current') return Response(json.dumps('request accepted'), status=202, mimetype='application/json')