Proposal
I would love to have a CLI or Node.js API to implement into my ruby project without an external server.
Tasks
Motivation
State of now, you need to have a server which powers the image generation. However, we don't want the costs of an extra server/droplet on Heroku, just for generating images once in a while.
So, it would be nice to have a CLI or Node.js API, which is giving us the power to generate such an image, without the need to have a server up and running all the time.
Concept
CLI
I would prefer two different things, one would be the CLI, which can be used like this:
pupy-image-gen --content="This is a sample text for generating an image." --color="#ff0000"
The above snippet would create an image for us with the content of "This is a sample text for generating an image." and the background color of "#ff0000" (red).
Possible options would be in my eyes:
| Argument |
What id does |
Required |
Default |
content |
The text which should be written on our template. |
true |
|
color |
The background color (if template is transparent) |
false |
primary color of pupy |
templateFolder |
The folder where the templates live. |
false |
bundled with package |
Node.js API
const generateImage = require('@pupy/image-gen`)
const image = generateImage({ content: 'Example text' }).toBuffer()
generateImage is simply returning us the whole API, which is exposed by node-canvas. So, you can use functions as toBuffer(). For more information see here.
For the options, I would go with the same as the CLI, so we don't differ from each other.
Proposal
I would love to have a CLI or Node.js API to implement into my ruby project without an external server.
Tasks
Motivation
State of now, you need to have a server which powers the image generation. However, we don't want the costs of an extra server/droplet on Heroku, just for generating images once in a while.
So, it would be nice to have a CLI or Node.js API, which is giving us the power to generate such an image, without the need to have a server up and running all the time.
Concept
CLI
I would prefer two different things, one would be the CLI, which can be used like this:
The above snippet would create an image for us with the content of "This is a sample text for generating an image." and the background color of "#ff0000" (red).
Possible options would be in my eyes:
contenttruecolorfalsetemplateFolderfalseNode.js API
generateImageis simply returning us the whole API, which is exposed bynode-canvas. So, you can use functions astoBuffer(). For more information see here.For the options, I would go with the same as the CLI, so we don't differ from each other.