add installation and build
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ output.mp4
|
||||
resp.txt
|
||||
test.png
|
||||
resized.jpg
|
||||
build/
|
@ -31,7 +31,7 @@ func main() {
|
||||
|
||||
app := &cli.App{
|
||||
Name: "i2v",
|
||||
Usage: "A command line tool to convert images to videos, based on Stability.ai's Rest API.",
|
||||
Usage: "A command line tool to convert images to videos, based on Stability.ai's Rest API.\n\nSet the `STABILITY_API_KEY` environment variable to your API key.",
|
||||
Version: "v1.0.0",
|
||||
Description: "i2v (Image to Video) is a command line tool to convert images to videos, based on Stability.ai's Rest API.",
|
||||
Commands: commands,
|
||||
|
33
go-executable-build.bash
Normal file
33
go-executable-build.bash
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
package=$1
|
||||
package_name=$2
|
||||
if [[ -z "$package" ]]; then
|
||||
echo "usage: $0 <package-name> <tool-name>"
|
||||
exit 1
|
||||
fi
|
||||
package_split=(${package//\// })
|
||||
#package_name=${package_split[-1]}
|
||||
if [[ -z "$package_name" ]]; then
|
||||
package_name=${package_split[-1]}
|
||||
fi
|
||||
|
||||
platforms=("windows/amd64" "windows/arm64" "darwin/amd64" "darwin/arm64" "linux/amd64" "linux/arm64")
|
||||
|
||||
for platform in "${platforms[@]}"
|
||||
do
|
||||
platform_split=(${platform//\// })
|
||||
GOOS=${platform_split[0]}
|
||||
GOARCH=${platform_split[1]}
|
||||
output_name=$package_name'-'$GOOS'-'$GOARCH
|
||||
if [ $GOOS = "windows" ]; then
|
||||
output_name+='.exe'
|
||||
fi
|
||||
output_name='build/'$output_name
|
||||
|
||||
env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name $package
|
||||
if [ $? -ne 0 ]; then
|
||||
echo 'An error has occurred! Aborting the script execution...'
|
||||
exit 1
|
||||
fi
|
||||
done
|
67
installation-and-usage.md
Normal file
67
installation-and-usage.md
Normal file
@ -0,0 +1,67 @@
|
||||
# i2v (Image to Video)
|
||||
|
||||
## Get set up with stability.ai
|
||||
|
||||
Set up an account with stability.ai add credits and set up an API key here: https://platform.stability.ai/account/keys
|
||||
|
||||
Once you've created an API key you should set it as an environment variable on your system. Specific instructions for each platform can be found below.
|
||||
|
||||
## How to install
|
||||
|
||||
### Windows
|
||||
|
||||
Download the file `i2v-windows-amd64.exe` or `i2v-windows-arm64.exe`. Place the file somewhere on your path. I usually change the name of the file to `i2v.exe`.
|
||||
|
||||
I usually have a folder named 'bin' in my user's home folder. I then make sure that folder is on my path by adding it to the path system environment variable. Here is a link with instructions on how to do that: https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574(v=office.14)
|
||||
|
||||
To set the API key in your environment you can follow the above linked instructions for updating your PATH variable but instead of changing your PATH, you can create a new variable.
|
||||
|
||||
It should be called `STABILITY_API_KEY` and should have the value of the API key you created when you set up your stability.ai account.
|
||||
|
||||
### Mac
|
||||
|
||||
Download the file `i2v-darwin-amd64` or `i2v-darwin-arm64`. Place the file somewhere on your path. I usually change the name of the file to `i2v`.
|
||||
|
||||
Set an environment variable named `STABILITY_API_KEY` with the value of the API key created when you set up your stability.ai account.
|
||||
|
||||
### Linux
|
||||
|
||||
Download the file `i2v-linux-amd64` or `i2v-linux-arm64`. Place the file somewhere on your path. I usually change the name of the file to `i2v`.
|
||||
|
||||
Set an environment variable named `STABILITY_API_KEY` with the value of the API key created when you set up your stability.ai account.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
% i2v -h # windows will be `i2v.exe -h`
|
||||
NAME:
|
||||
i2v - A command line tool to convert images to videos, based on Stability.ai's Rest API.
|
||||
|
||||
USAGE:
|
||||
i2v [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
v1.0.0
|
||||
|
||||
DESCRIPTION:
|
||||
i2v (Image to Video) is a command line tool to convert images to videos, based on Stability.ai's Rest API.
|
||||
|
||||
AUTHOR:
|
||||
Mason Payne <mason@masonitestudios.com>
|
||||
|
||||
COMMANDS:
|
||||
get-job-result, gjr Get the result of a job
|
||||
resize, r Resize an image to a supported size for the API
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
GLOBAL OPTIONS:
|
||||
--output value, -o value path to output file (should be a mp4) (default: "./output.mp4")
|
||||
--format value, -f value The format to resize the image to wide, tall, or square (default: "wide")
|
||||
--help, -h show help
|
||||
--version, -v print the version
|
||||
|
||||
COPYRIGHT:
|
||||
2023 Masonite Studios LLC
|
||||
```
|
||||
|
||||
You can get more help for a specific command by adding the help option after the command e.g. `i2v resize -h`
|
Reference in New Issue
Block a user