IMGPA (Image Processing API) provides an API for image manipulation using sharp. The API allows you to resize images, change formats, and adjust quality.
ㅤ
ㅤ
ㅤ
-
Open your terminal and clone this repository:
git clone https://github.com/sekedus/imgpa.git
-
Change to the cloned directory:
cd imgpa -
Install the required dependencies:
npm install
-
Start the server:
npm start
-
The server will start on port
3000by default. You can access the API athttp://localhost:3000/imgpa.
ㅤ
Endpoint: /imgpa
| Name | Parameter | Description | Info |
|---|---|---|---|
| URL | url |
The URL of the image to manipulate (required). | |
| Width | w |
Sets the width of the output image, in pixels. | |
| Height | h |
Sets the height of the output image, in pixels. | |
| Fit | fit |
Sets how to fit the image to its given dimensions. | info |
| Quality | q |
Defines the quality of the output image (1-100). | |
| Format | format |
Encodes the output image to a specific format. | info |
| Filename | filename |
The name to save the output image as. | |
| Referer | ref |
Sets the HTTP Referer header for the request. | |
| Proxy | proxy |
Base URL of a proxy to use if direct access to the image URL is not possible. | |
| Hide Error | hide_error or he |
Allows processing even if image has issues. |
Note: Proxy support uses cf-proxy-ex. You can create your own proxy through a Cloudflare Worker.
http://localhost:3000/imgpa?url=https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/2160px-Google_2015_logo.svg.png&w=340&h=226&fit=contain&quality=80&format=webp&filename=new-image
- jpeg
- png
- webp
- gif
- avif
- tiff
- svg
For more details, see the sharp documentation on supported formats.
ㅤ
Click the button below to deploy this project to Vercel:
ㅤ
-
Install Vercel CLI globally:
npm install -g vercel
-
Log in to your Vercel account:
vercel login
-
Deploy your application to Vercel:
vercel --prod
-
Follow the prompts to complete the deployment process.
ㅤ
ㅤ
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.