download small size image
This commit is contained in:
parent
c5f4accbff
commit
5450fd2234
@ -96,7 +96,13 @@ export default function Editor(props: EditorProps) {
|
||||
context.clearRect(0, 0, context.canvas.width, context.canvas.height)
|
||||
const currRender = renders[renders.length - 1]
|
||||
if (currRender?.src) {
|
||||
context.drawImage(currRender, 0, 0)
|
||||
context.drawImage(
|
||||
currRender,
|
||||
0,
|
||||
0,
|
||||
original.naturalWidth,
|
||||
original.naturalHeight
|
||||
)
|
||||
} else {
|
||||
context.drawImage(original, 0, 0)
|
||||
}
|
||||
|
21
main.py
21
main.py
@ -14,9 +14,14 @@ import torch
|
||||
from flask import Flask, request, send_file
|
||||
from flask_cors import CORS
|
||||
|
||||
from lama_cleaner.helper import (download_model, load_img, norm_img,
|
||||
numpy_to_bytes, pad_img_to_modulo,
|
||||
resize_max_size)
|
||||
from lama_cleaner.helper import (
|
||||
download_model,
|
||||
load_img,
|
||||
norm_img,
|
||||
numpy_to_bytes,
|
||||
pad_img_to_modulo,
|
||||
resize_max_size,
|
||||
)
|
||||
|
||||
NUM_THREADS = str(multiprocessing.cpu_count())
|
||||
|
||||
@ -63,11 +68,11 @@ def process():
|
||||
res_np_img = run(image, mask)
|
||||
|
||||
# resize to original size
|
||||
res_np_img = cv2.resize(
|
||||
res_np_img,
|
||||
dsize=(original_shape[1], original_shape[0]),
|
||||
interpolation=interpolation,
|
||||
)
|
||||
# res_np_img = cv2.resize(
|
||||
# res_np_img,
|
||||
# dsize=(original_shape[1], original_shape[0]),
|
||||
# interpolation=interpolation,
|
||||
# )
|
||||
|
||||
return send_file(
|
||||
io.BytesIO(numpy_to_bytes(res_np_img)),
|
||||
|
Loading…
Reference in New Issue
Block a user