Command Line Image Tools: Difference between revisions
Jump to navigation
Jump to search
Tag: wikieditor |
Tag: wikieditor |
||
| Line 48: | Line 48: | ||
=== Inspecting metadata === | === Inspecting metadata === | ||
Applying the following command to a Photoshop file results in a lot of overly verbose information. | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Revision as of 18:33, 7 April 2023
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.
# changes aspect ratio $ sips -z [height] [width] path/to/image.jpg # maintains aspect ratio $ sips -z [heightwidth] path/to/image.jpg # rotate image sips -r 90 path/to/file.jpg --out rotatedfile.jpg
Inspecting metadata
sips supports NEF and PSD file format along with the more command image formats.
$ 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
Converting file formats
$ sips -s format jpeg -s formatOptions 80 "source_image.tiff" --out "converted_image.jpg"
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.
$ 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
Editing images
exiftool can also edit images, e.g. |rotating NEF files.
ffmpeg
ffmpeg is useful for converting image files to different formats.