Open REST API to generate images of quotes
To generate an image using the API,
Make a HTTP POST request to https://quote2img.vercel.app/api/imagequote with the follwing JSON in the request body.
The styleName
property can either be set to light
or dark
.
The generated images will be 1080x1080
{
"quoteText": "If you are depressed you are living in the past, if you are anxious you are living in the future. If you are at peace, you are living in the present.",
"authorName": "Lao Tzu",
"styleName": "light"
}
Note: The generated image will be saved to the file image.png in your current working directory.
curl --location --request POST 'quote2img.vercel.app/api/imagequote' \
--header 'Content-Type: application/json' \
--data-raw '{
"quoteText": "If you are depressed you are living in the past, if you are anxious you are living in the future. If you are at peace, you are living in the present.",
"authorName": "Lao Tzu",
"styleName": "light"
}' \
-o image.png
- Since this project uses Vercel Serverless functions,
vercel
has to be installed.npm i -g vercel
- Navigate to the project root folder and run
vercel dev
to start the local development server on localhost port 3000.