sa_br
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://pro767--ebb6d6de335011f0a5739e149126039e.web.val.run
A simple web application that allows users to upload images and remove their backgrounds using the Remove.bg API.
- Drag and drop image upload
- Preview of original and processed images
- Download processed images with transparent backgrounds
- Responsive design that works on mobile and desktop
This application requires a Remove.bg API key to function. You need to set up an environment variable in Val Town:
- Sign up for a free account at Remove.bg
- Get your API key from the Remove.bg dashboard
- Add the API key as an environment variable in Val Town:
- Variable name:
REMOVE_BG_API_KEY - Value: Your Remove.bg API key
- Variable name:
- Upload an image by dragging and dropping it onto the designated area or by clicking to select a file
- Click the "Remove Background" button to process the image
- Once processing is complete, you can download the image with the background removed
- The free tier of Remove.bg API has a limited number of API calls (typically 50 images per month)
- Maximum file size is 10MB
- Supported file formats: PNG, JPG, JPEG
If you encounter issues with the application, here are some common problems and solutions:
- Make sure you've added the
REMOVE_BG_API_KEYenvironment variable in Val Town - Verify that the API key is correct and active in your Remove.bg dashboard
- The free tier of Remove.bg has a limited number of API calls
- If you see a 429 error, you've exceeded your monthly quota
- Consider upgrading your Remove.bg plan for more credits
- Make sure your image is in a supported format (PNG, JPG, JPEG)
- Check that the image size is under 10MB
- Some complex images might not process correctly
This application is built using:
- Frontend: HTML, CSS (with Tailwind via CDN), and vanilla JavaScript
- Backend: Hono framework running on Val Town's Deno runtime
- Image processing: Remove.bg API
/index.ts- Main HTTP handler and API endpoint/frontend/index.html- Frontend UI for the application