imgcat command outputs images to the terminal, allowing you to view image files directly in your WezTerm session.
Synopsis
Description
Displays an image file in the terminal using the iTerm2 inline images protocol. WezTerm supports rendering images with automatic sizing, aspect ratio preservation, and various formatting options.Arguments
The name of the image file to be displayed.If omitted,
imgcat will attempt to read the image data from stdin, allowing you to pipe images from other commands.Supported formats: PNG, JPEG, GIF (including animated), BMP, and other formats supported by the image library.Examples:Display Options
Specify the display width. Defaults to
"auto" which automatically selects an appropriate size.Format options:N- Number of cells (e.g.,80)Npx- Number of pixels (e.g.,800px)N%- Percentage of terminal width (e.g.,50%)auto- Automatic sizing (default)
Specify the display height. Defaults to
"auto" which automatically selects an appropriate size.Format options:N- Number of cells (e.g.,24)Npx- Number of pixels (e.g.,600px)N%- Percentage of terminal height (e.g.,50%)auto- Automatic sizing (default)
Do not respect the aspect ratio. The default is to respect the aspect ratio.When aspect ratio is preserved (default), specifying only width or height will automatically calculate the other dimension. Use this flag to force exact dimensions.
Position and Cursor Options
Set the cursor position prior to displaying the image.The default is to use the current cursor position. Coordinates are expressed in cells with 0,0 being the top left cell position.Format:
x,y (comma-separated)Example:Do not move the cursor after displaying the image.
Wait for Enter/Escape/Ctrl-C/Ctrl-D to be pressed after displaying the image.This is useful when combined with
--no-move-cursor to prevent the image from being immediately overwritten by the prompt.Image Processing Options
Set the maximum number of pixels per image frame.Images will be scaled down so that they do not exceed this size, unless Example:
--no-resample is also used. The default value (25,000,000) matches the limit set by WezTerm.Resampling the image will reduce any animated images to a single frame.
Do not resample images whose frames are larger than the
--max-pixels value.Pre-process the image to resize it to the specified dimensions, expressed as Example:
WIDTHxHEIGHT (e.g., 800x600).The resize is independent of other parameters that control the image placement and dimensions in the terminal. This is provided as a convenience preprocessing step.Resizing animated images will reduce the image to a single frame.
Specify the image format to use to encode resampled/resized images.The default is to match the input format, but you can choose an alternative format.Possible values:
png- PNG formatjpeg- JPEG formatinput- Match input format (default)
Specify the filtering technique used when resizing/resampling images.The default (
catmull-rom) is a reasonable middle ground of speed and quality.Possible values:nearest- Fastest, lowest qualitytriangle- Fast, low qualitycatmull-rom- Balanced (default)gaussian- Slower, higher qualitylanczos3- Slowest, highest quality
When resampling or resizing, display some diagnostics around the timing/performance of that operation.Useful for debugging performance issues with large images.
Tmux Integration
How to manage passing the escape sequence through to tmux.Possible values:
disable- Don’t use tmux passthroughenable- Always use tmux passthroughdetect- Automatically detect if running in tmux (default)
Examples
Basic image display
Display image from URL
Display with specific width
Display at half terminal size
Display without preserving aspect ratio
Display and hold for viewing
Resize large image before display
High-quality resampling
Display at specific position
Display multiple images in a grid
Convert and display
Screenshot and display
Performance Tips
- Large images are automatically resampled to the
--max-pixelslimit - Use
--resizeto preprocess very large images - For better quality with resampling, use
--resample-filter lanczos3 - For faster display of many images, use
--resample-filter nearest
Animated GIFs
WezTerm supports animated GIFs:If an animated GIF exceeds the
--max-pixels limit and is resampled, it will be reduced to a single frame.Troubleshooting
Image doesn’t display:- Check that the image format is supported
- Ensure the image file exists and is readable
- Try with
--max-pixelswith a smaller value
- Use
--widthand--heightto control display size - Use
--resizeto preprocess the image
- Check if
--no-preserve-aspect-ratiois set - Specify only width or height and let WezTerm calculate the other
- Use
--holdto wait before returning to prompt - Use
--no-move-cursorwith--hold
Related
- wezterm set-working-directory - Set terminal working directory
- wezterm start - Start a terminal session