Editing
Command Line Image Tools
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Preview == To preview an image file from the command line: <syntaxhighlight lang="bash"> $ qlmanage -p filename.jpg </syntaxhighlight> == Extracting metadata == === Using ImageMagick === <syntaxhighlight lang="bash"> $ convert filename.jpg -print "%w x %h\n" /dev/null </syntaxhighlight> == sips == `sips` is a command line tool installed by default on Mac OS. === Editing images === It can be used to flip, crop, and resize image files. <syntaxhighlight lang="bash"> # changes aspect ratio $ sips -z [height] [width] path/to/image.jpg # maintains aspect ratio; width and height cannot exceed value; N.B. uppercase "Z" $ sips -Z [heightwidth] path/to/image.jpg # rotate image sips -r 90 path/to/file.jpg --out rotatedfile.jpg </syntaxhighlight> === Inspecting metadata === `sips` supports NEF and PSD file format along with the more command image formats. <syntaxhighlight lang="bash"> $ sips -g all path/file.extension pixelWidth: 1920 pixelHeight: 1080 typeIdentifier: public.jpeg format: jpeg formatOptions: default dpiWidth: 72.000 dpiHeight: 72.000 samplesPerPixel: 3 bitsPerSample: 8 hasAlpha: no space: RGB profile: sRGB IEC61966-2.1 </syntaxhighlight> === Converting file formats === <syntaxhighlight lang="bash"> $ sips -s format jpeg -s formatOptions 80 "source_image.tiff" --out "converted_image.jpg" </syntaxhighlight> `formatOptions` controls the JPEG compression of the destination image. == exiftool == === Inspecting metadata === Applying the following command to a Photoshop file results in a lot of overly verbose information. <syntaxhighlight lang="bash"> $ exiftool paris-texas-00_05_34-00001.jpg ExifTool Version Number : 12.49 File Name : paris-texas-00_05_34-00001.jpg Directory : . File Size : 310 kB File Modification Date/Time : 2023:04:07 09:28:48-07:00 File Access Date/Time : 2023:04:07 11:13:20-07:00 File Inode Change Date/Time : 2023:04:07 09:28:48-07:00 File Permissions : -rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Resolution Unit : None X Resolution : 1 Y Resolution : 1 Image Width : 1920 Image Height : 1080 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 1920x1080 Megapixels : 2.1 </syntaxhighlight> === Editing images === `exiftool` can also edit images, e.g. [[Change Orientation of NEF Files in EXIF Data||rotating NEF files]]. == ffmpeg == `ffmpeg` is useful for [[Batch Converting Image Files|converting image files to different formats]]. == See also == * [[Batch Converting Image Files]] * [[Change Orientation of NEF Files in EXIF Data]] [[Category:Command Line]][[Category:Bash]][[Category:Zsh]]
Summary:
Please note that all contributions to Littledamien Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Littledamien Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information