We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
here is my backend: import express from 'express'; import multer from 'multer'; import { removeBackground } from '@imgly/background-removal-node';
const router = express.Router(); const upload = multer({ storage: multer.memoryStorage() });
router.post('/remove-background', upload.single('image'), async (req, res) => { try { const imageBuffer = req.file.buffer; const blob = await removeBackground(imageBuffer);
const buffer = Buffer.from(await blob.arrayBuffer()); const dataURL = `data:image/png;base64,${buffer.toString("base64")}`; res.json({ imageUrl: dataURL }); } catch (error) { res.status(500).json({ error: 'Failed to remove background', message: error.message }); }
});
export default router;
FE Implentation: const handleRemoveBackground = async () => { if (!imageFile) { console.error('No image file available for background removal.'); return; }
setLoading(true); const formData = new FormData(); formData.append('image', imageFile); try { const response = await fetch('http://localhost:8080/api/v1/background/remove-background', { method: 'POST', body: formData }); if (!response.ok) { throw new Error('Network response was not ok'); } const data = await response.json(); setImageSrc(data.imageUrl); } catch (error) { console.error('Error removing background:', error); } finally { setLoading(false); }
}; keep getting internal server error plz help
The text was updated successfully, but these errors were encountered:
No branches or pull requests
here is my backend:
import express from 'express';
import multer from 'multer';
import { removeBackground } from '@imgly/background-removal-node';
const router = express.Router();
const upload = multer({ storage: multer.memoryStorage() });
router.post('/remove-background', upload.single('image'), async (req, res) => {
try {
const imageBuffer = req.file.buffer;
const blob = await removeBackground(imageBuffer);
});
export default router;
FE Implentation:
const handleRemoveBackground = async () => {
if (!imageFile) {
console.error('No image file available for background removal.');
return;
}
};
keep getting internal server error plz help
The text was updated successfully, but these errors were encountered: