make-placeholder is a command-line tool designed for generating placeholders for your projects.
Node.js >= 16.x
To install make-placeholder globally, use the following command:
npm install -g make-placeholder
The primary command provided by make-placeholder is img
. You can use this command to generate image placeholders with various customization options.
make-placeholder img <width> [height] [options]
-
<width>
(in pixels): The width of the image (required). -
[height]
(in pixels): The height of the image (optional, defaults to the width). -
[options]
: Additional options to customize the image placeholder.
Note: The units for <width>
and [height]
are expressed in pixels (px).
-
-b, --background <background>
: Set the background color for the image. Default:#cccccc
. -
-c, --text-color <text_color>
: Define the text color for the text on the image. Default:#909090
. -
-t, --text <text>
: Specify the text to display on the image. -
-o, --output-path <output_path>
: Set the output path for the image (e.g., "/path/to/output/example.jpeg"). If you include * in the file name, it will be replaced with the dimension of the image (only the last * will be replaced).
Note: When specifying the value for any color options, you can set the color in various formats, including Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, and Named colors.
Generate a 256x256px image placeholder with default settings:
make-placeholder img 256
Note: When not providing a custom name using the -o
flag, the output file name will be automatically created based on the image dimensions, followed by the format (defaulting to JPEG). For instance, generating a 256x256px JPEG image will produce a file named "256x256.jpeg".
Generate a 512x256px image placeholder with a black background, white text, and a custom text message:
make-placeholder img 512 256 -b "#000000" -c white -t "hello world"
Generate a 128x128px image placeholder and save it to a specific directory:
make-placeholder img 128 -o "/path/to/folder/placeholder.jpeg"
The supported file formats are: JPEG
(default), PNG
, BMP
, TIFF
, and GIF
Use the following command to specify a directory path and generate an image with a dynamic filename:
make-placeholder img 64 -o "/path/to/folder/*.png"
This command will create an image named "64x64.png" in the folder you specified.
If you want to save the PNG image in the current directory, use the following command:
make-placeholder img 64 -o "*.png"
This will create an image named "64x64.png" in your current working directory.
If you encounter any issues or have suggestions for improvement, please open an issue.
Contributions are welcome! Please check the Contributing Guidelines to get started.
This project is licensed under the MIT License. See the LICENSE file for details.