qlmanage Quick Look Functionality in macOS Terminal
Learn about qlmanage a macOS command-line utility for Quick Look previews and thumbnail generation in the terminal. Enhance your workflow.
Overview
The qlmanage command-line utility extends macOS Quick Look functionality to the terminal, enabling users to preview files and generate thumbnails without opening applications. While primarily a debugging tool for developers, qlmanage offers practical file management and preview capabilities for all macOS users.
Key Insights
- Terminal Integration:
qlmanagebrings Quick Look features directly to the command line. - Debugging Tool: Although powerful,
qlmanageis primarily designed for developers and can exhibit more complex behaviors than standard commands. - Core Functions: It supports generating live previews (
-p) and creating static thumbnail images (-t). - Thumbnail Customization: Users can control thumbnail output directory (
-o) and size, either by absolute pixel dimension (-s) or as a factor of the original (-f). - Streamlined Workflow: Integrating
qlmanageinto terminal workflows enhances file management and preview tasks.
Technical Details
Command Overview and Syntax
The qlmanage utility provides functions for Quick Look, including preview generation, thumbnail creation, and plugin testing. Its basic syntax is:
qlmanage [options] file...
The file parameter accepts one or more file paths for interaction.
Common Options
-p: Generates a Quick Look preview of the specified files, opening a standard Quick Look window.-t: Generates thumbnail images for the specified files.-o directory: Specifies the outputdirectoryfor generated files, such as thumbnails.-s size: Defines the maximumsize(in pixels) for generated thumbnails. This applies to either width or height, maintaining the aspect ratio.-f factor: Adjusts the thumbnail size as afactorof the original image’s dimensions. For instance,0.5creates a thumbnail at 50% of the original size.
Usage Examples
Generating Quick Look Previews
The -p option opens a Quick Look preview window for the specified file:
qlmanage -p example.txt
This command displays the contents of example.txt in a Quick Look window.
Creating Thumbnails
The -t option generates a thumbnail image. By default, the thumbnail saves in the same directory as the original file, appended with .thumbnail.
qlmanage -t example.jpg
This generates example.jpg.thumbnail.jpg in the current directory.
To specify an alternative output directory, use the -o option:
qlmanage -t example.jpg -o ~/Desktop/
This saves the thumbnail to the user’s Desktop.
Adjusting Thumbnail Size by Dimension (-s)
Use the -s option to define a maximum dimension (width or height) for the thumbnail in pixels:
qlmanage -t -s 200 example.jpg
This command generates a thumbnail for example.jpg with its largest dimension not exceeding 200 pixels.
Adjusting Thumbnail Size by Factor (-f)
The -f option sets the thumbnail size as a proportional factor of the original file. This is useful for maintaining consistent relative sizing across varied source images.
qlmanage -t -f 0.5 example.jpg
This command generates a thumbnail for example.jpg that is 50% of the original image’s dimensions. The -f option can be combined with -o for directory specification, similar to -s.