resize image using backend;add resize radio button
frontend resize image will reduce image quality
This commit is contained in:
@@ -2,12 +2,23 @@ import { dataURItoBlob } from '../utils'
|
||||
|
||||
export const API_ENDPOINT = `${process.env.REACT_APP_INPAINTING_URL}/inpaint`
|
||||
|
||||
export default async function inpaint(imageFile: File, maskBase64: string) {
|
||||
export default async function inpaint(
|
||||
imageFile: File,
|
||||
maskBase64: string,
|
||||
sizeLimit?: string
|
||||
) {
|
||||
// 1080, 2000, Original
|
||||
const fd = new FormData()
|
||||
fd.append('image', imageFile)
|
||||
const mask = dataURItoBlob(maskBase64)
|
||||
fd.append('mask', mask)
|
||||
|
||||
if (sizeLimit === undefined) {
|
||||
fd.append('sizeLimit', '1080')
|
||||
} else {
|
||||
fd.append('sizeLimit', sizeLimit)
|
||||
}
|
||||
|
||||
const res = await fetch(API_ENDPOINT, {
|
||||
method: 'POST',
|
||||
body: fd,
|
||||
|
||||
Reference in New Issue
Block a user