Sign inSign up

orhunp/menyoki

By orhunp

Updated 2 days ago

Image
1

5.4K

orhunp/menyoki repository overview


Screen{shot,cast} and perform ImageOps on the command line 🌱 🏞️


menyoki is a screencast and screenshot utility that can also perform various image related operations such as making/splitting GIFs and modifying/analyzing/viewing image files. It aims to be a lightweight command line tool for either helping out on day-to-day life operations or complicated detail-centric issues. Originally it was designed to record/screenshot terminal windows but it can be tweaked easily for other purposes with command line arguments, environment variables, or a configuration file.

Table of Contents

Supported Platforms

  • Linux
  • Windows (no record/capture)
  • macOS (no record/capture)

menyoki requires a window system implementation of the supported platform for record and capture actions. Other features are expected to work normally since they don't require a window system running (or grabbing a window to operate on). For example, despite the macOS is not listed as a supported platform, menyoki still can perform image operations such as edit, analyze and view if it's compiled on macOS.

Supported Formats

Installation

Packaging status

Requirements
  • Rust: 1.44.0+
  • Dependencies
    • Arch Linux: libx11, libxrandr
    • Debian, Ubuntu: libx11-dev/librust-x11-dev, libxrandr-dev
    • Fedora: libX11-devel, libXrandr
Cargo

menyoki can be installed from crates.io using cargo if Rust is installed.

cargo install menyoki

Use --force option to update.

cargo install menyoki --force
Arch Linux

menyoki can be installed from the Arch Linux community repository.

pacman -S menyoki

Or if you prefer, you can use an available AUR package for installation.

paru menyoki
  • Clone the package and compile it with makepkg:
git clone https://aur.archlinux.org/menyoki-git.git
cd menyoki-git
makepkg -si
Docker
Docker Hub

Download the orhunp/menyoki image from Docker Hub (see available tags):

docker pull orhunp/menyoki:<tag>

Run a container:

docker run orhunp/menyoki:<tag>
Building an image

After cloning the repository, you can build an image from Dockerfile:

docker build -t menyoki .

Then you can either run a container:

docker run menyoki

or spawn a shell inside the container with running it interactively:

docker run -it menyoki /bin/bash
Manual
From source
  1. Clone the repository.
git clone https://github.com/orhun/menyoki.git && cd menyoki/
  1. Build the project and install binary.
cargo install --path .
Releases
  1. Download the latest archive from releases page and extract it.
  2. Move menyoki binary to /usr/local/bin/ (Linux)

Features

Usage

Action
Result

Command line arguments of menyoki are designed to be as intuitive as possible. As a result of that, an action can be performed with a chain of subcommands along with the flags and options. The general prototype for the usage of command line arguments is the following:

menyoki (ACTION) (FORMAT) (OUTPUT)

The subcommand that will indicate the action is mandatory whereas format and output subcommands might be optional (or they might not exist at all). The format subcommand can be one of the supported formats and output basically corresponds to the save subcommand.

The default format is the first listed subcommand if there is not any subcommand given for specifying a format. On the other hand, save subcommand uses the "menyoki" directory in the home (or images if it exists) as the default output directory.

General

Flags and options that will generally affect the execution of menyoki can be set before specifying the main action to perform. Then the main subcommand (action) must be specified.

menyoki [FLAGS] [OPTIONS] <SUBCOMMAND>

Arguments
FLAGS:
    -h, --help       Print help information
    -V, --version    Print version information
    -v, --verbose    Increase logging verbosity
    -q, --quiet      Do not show output

OPTIONS:
    -c, --config <FILE>    Set the configuration file
        --color <HEX>      Set the main color [default: 3AA431]

SUBCOMMANDS:
    record     Record an animation
    split      Split an animation into frames
    make       Make an animation from frames
    capture    Capture an image
    edit       Edit an image
    analyze    Analyze an image
    view       View an image
Examples
CommandAction
menyoki -VPrint the version information
menyoki -vv --color FF00FF <action>Set log verbosity level to 2 (trace) and use "FF00FF" as the main color
menyoki -q -c menyoki.conf <action>Run in quiet mode and read the configuration from "menyoki.conf"
Record

menyoki can record an area of a window or the whole screen and encode it as a supported format. Area selection and resize is performed with the key bindings.

A few scenarios that record action might be helpful would be:

  • Record a specific area of a window
  • Record for a given duration
  • Record the output of a command (especially for TUI applications)

Encoding options can be changed using the arguments of the provided format. (See the output of menyoki record gif --help)

menyoki record [FLAGS] [OPTIONS] [COMMAND] [SUBCOMMAND]

Arguments
FLAGS:
    -r, --root          Record the root window
    -f, --focus         Record the focused window
        --select        Select the window to record
        --parent        Record the parent of the window
        --with-alpha    Record with the alpha channel
        --no-keys       Disable the action keys while recording
    -m, --mouse         Select the window with mouse click
    -h, --help          Print help information

OPTIONS:
        --action-keys <KEYS>    Set the action keys [default: LAlt-S,LAlt-Enter]
        --cancel-keys <KEYS>    Set the cancel keys [default: LControl-D,Escape]
    -b, --border <BORDER>       Set the border width [default: 1]
    -p, --padding <T:R:B:L>     Set the record area padding
    -s, --size <WxH>            Set the record area size
    -d, --duration <S>          Set the duration for recording [default: ∞]
    -c, --countdown <S>         Set the countdown before recording [default: 3]
    -t, --timeout <S>           Set the timeout for window selection [default: 300]
    -i, --interval <MS>         Set the refresh interval for window selection [default: 10]
        --font <FONT>           Set the font to use for window selection
        --monitor <NUM>         Set the monitor to record as root window

ARGS:
    <COMMAND>    Set the command to run

SUBCOMMANDS:
    gif     Use the GIF encoder
    apng    Use the APNG encoder
    save    Save the output file(s)
Examples
CommandAction
menyoki recordSelect a window and start recording with default settings
menyoki record --root --countdown 5Record the root window after 5 seconds of countdown
menyoki record --focus --with-alphaRecord the focused window with the alpha channel (for transparency)
menyoki record --size 200x300 --duration 10Record an area of size 200x300 for 10 seconds
menyoki record --padding 20:10:0:10 --timeout 120Record an area with given padding and set window selection timeout to 120 seconds
menyoki record --parentRecord the parent window of the selected window
menyoki record --root --select --monitor 1Record the first monitor as root window
menyoki record --border 5Record the area selected by a border with 5 width
menyoki record --action-keys LControl-Q,LAlt-WRecord with the default settings using custom key bindings
menyoki record --cancel-keys LControl-X,ERecord with the default settings using custom key bindings
menyoki record gif --fps 15 --quality 90Record 15 frames per second with 90% quality
menyoki record gif --gifskiRecord and encode using the gifski encoder
menyoki record gif save "test.gif" --timestampRecord and save as "test.gif" with timestamp in the file name
menyoki record apng --fps 30Record 30 frames per second and encode as APNG
menyoki -q record save "-" > test.gifRecord and redirect output to "test.gif"
menyoki -q record save "-" | xclip -selection clipboard -t image/gifRecord and pipes output to xclip's clipboard selection, specifying target as a gif
menyoki -q record "kmon -t 2000"Execute the command and record its output in quiet mode
menyoki record --font "-*-dejavu sans-*-*-*-*-17-*-*-*-*-*-*-*"Use custom font for showing the area size (see xfontsel)
Pro Tip

Use slop for selecting an area of the root window (fullscreen) with mouse interaction.

menyoki record --root --size $(slop)
Split

menyoki can split an animation into frames (extract images) if the split subcommand is provided and it can save frames as one of the supported formats with the use of trailing format subcommand.

menyoki split [OPTIONS] <FILE> [SUBCOMMAND]

Arguments
FLAGS:
    -h, --help    Print help information

OPTIONS:
    -d, --dir <DIRECTORY>    Set the output directory

ARGS:
    <FILE>    Set the animation file

SUBCOMMANDS:
    png     Use the PNG encoder
    jpg     Use the JPG encoder
    bmp     Use the BMP encoder
    ico     Use the ICO encoder
    tiff    Use the TIFF encoder
    tga     Use the TGA encoder
    pnm     Use the PNM encoder
    ff      Use the farbfeld encoder
Examples
CommandAction
menyoki split rec.gifExtract frames from the "rec.gif" file
menyoki split rec.gif jpg --quality 100Extract frames as JPEG in maximum quality
menyoki split rec.gif --dir frames/Extract frames and save them to the specified directory
Make

make subcommand serves the purpose of creating an animation from a set of images. For example, it can be used for making GIFs from given images either via the command line or the specified directory.

menyoki make [FLAGS] [OPTIONS] <FRAMES>... [SUBCOMMAND]

Arguments
FLAGS:
        --gifski     Use the gifski encoder
        --fast       Encode 3 times faster (gifski)
    -n, --no-sort    Use frames in the order given
    -h, --help       Print help information

OPTIONS:
    -f, --fps <FPS>            Set the FPS [default: 20]
    -q, --quality <QUALITY>    Set the frame quality (1-100) [default: 75]
    -r, --repeat <REPEAT>      Set the number of repetitions [default: ∞]
    -d, --dir <DIRECTORY>      Set the directory to read frames
        --format <FORMAT>      Set the animation format [default: gif]  [possible values: gif, apng]

ARGS:
    <FRAMES>...    Set the animation frames

SUBCOMMANDS:
    save    Save the output file(s)
Examples
CommandAction
menyoki make 1.png 2.pngMake a GIF that consists of two frames as "1.png" and "2.png"
menyoki make 1.png 2.png --fps 5 --quality 100Make a GIF with the specified properties from given frames
menyoki make 1.png 2.png save 3.gif --dateMake a GIF and save the file ("3.gif") with the date information
menyoki make 1.png 2.png --format apngMake an APNG from the given frames
menyoki make --dir frames/Make a GIF from the frames in the specified directory
Capture

menyoki can capture (screenshot) an area of a window or the whole screen and encode it as a supported format. Formats like png, jpg, and pnm have their own flags and options that might be used for changing the default encoding settings. Similar to the record subcommand, area selection and resize is performed with the key bindings. The same flags and options might apply for both record and capture subcommands since the actions are abstractly alike.

menyoki capture [FLAGS] [OPTIONS] [COMMAND] [SUBCOMMAND]

Arguments
FLAGS:
    -r, --root          Capture the root window
    -f, --focus         Capture the focused window
        --select        Select the window to capture
        --parent        Record the parent of the window
        --with-alpha    Capture with the alpha channel
    -m, --mouse         Select the window with mouse click
    -h, --help          Print help information

OPTIONS:
        --action-keys <KEYS>    Set the action keys [default: LAlt-S,LAlt-Enter]
        --cancel-keys <KEYS>    Set the cancel keys [default: LControl-D,Escape]
    -b, --border <BORDER>       Set the border width [default: 1]
    -p, --padding <T:R:B:L>     Set the capture area padding
    -s, --size <WxH>            Set the capture area size
    -c, --countdown <S>         Set the countdown before capturing [default: 0]
    -t, --timeout <S>           Set the timeout for window selection [default: 300]
    -i, --interval <MS>         Set the refresh interval for window selection [default: 10]
        --font <FONT>           Set the font to use for window selection
        --monitor <NUM>         Set the monitor to capture as root window

ARGS:
    <COMMAND>    Set the command to run

SUBCOMMANDS:
    png     Use the PNG encoder
    jpg     Use the JPG encoder
    bmp     Use the BMP encoder
    ico     Use the ICO encoder
    tiff    Use the TIFF encoder
    tga     Use the TGA encoder
    pnm     Use the PNM encoder
    ff      Use the farbfeld encoder
    save    Save the output file(s)
Examples
CommandAction
menyoki captureSelect a window and screenshot with default settings
menyoki capture --root --countdown 5Screenshot the root window after 5 seconds of countdown
menyoki capture --focus --with-alphaScreenshot the focused window with the alpha channel (for transparency)
menyoki capture --size 200x300 --duration 10Screenshot an area of size 200x300 for 10 seconds
menyoki capture --padding 20:10:0:10 --timeout 120Screenshot an area with given padding and set window selection timeout to 120 seconds
menyoki capture --mouseScreenshot the selected window with a mouse click
menyoki capture png --filter avg --compression fastScreenshot and encode with the specified PNG options
menyoki capture jpg --quality 100Screenshot and encode with the specified JPEG options
menyoki capture pnm --format pixmap --encoding asciiScreenshot and encode with the specified PNM options
menyoki capture ff save "test.ff" --timestampScreenshot and save as "test.ff" in farbfeld format with timestamp in the file name
menyoki -q capture png save "-" > test.pngScreenshot and redirect output to "test.png"
menyoki -q capture png save "-" | xclip -selection clipboard -t image/pngScreenshot and pipe output to xclip's clipboard selection, specifying an image

Tag summary

Content type

Image

Digest

sha256:156549030

Size

30.4 MB

Last updated

2 days ago

docker pull orhunp/menyoki