User Tools

Site Tools


graphics_on_the_command_line

If you want to send us your comments, please do so. Thanks
More on comments


Graphics on the command line

Description of Exif file format

Commands

Official Debian image viewer packages with high relevance

CommandExplanationRemark
cjpeg / djpegConvert to/from the JPEG file formatPart of libjpeg-turbo-progs
convertConvert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much morePart of imagemagick
displayDisplays an image or image sequence on any X serverPart of imagemagick
exif
exiftags
exiftranDigital camera JPEG image transformer
exiv2
jheadjpeg exif editor
jpegpixiRemove hot spots from JPEG images with minimal quality loss
fehImage viewer and cataloguer
imagemagicCreate, edit, compose, or convert bitmap images in over 200 formats
imagetopsGeneric image to ps filter
jpegexiforient / exifautotranManipulate EXIF orientation tagPart of libjpeg-turbo-progs
jpegtopnmConvert JPEG/JFIF file to portable pixmap or graymap
jpegtranLossless transformations of JPEG filesPart of libjpeg-turbo-progs
libjpeg-turbo-progsprograms for manipulating JPEG files
rdjpgcom / wrjpgcomRead/write comments in JPEG filesPart of libjpeg-turbo-progs
renrotRename and rotate files according to EXIF tags
scrotScreen capture utility
tjbenchA simple JPEG benchmarking toolPart of libjpeg-turbo-progs
trendGeneral-purpose, efficient trend graph
webpConvert a webp picture to pngdwebp picture.webp -o picture.png. Other commands: cwebp (encoder)tool, dwebp (decoder), vwebp (viewer), wepmux (muxing tool), gif2webp (convert GIF images to WebP)
XliCommand line tool for viewing images in X11

Screenshot

-delayIn milliseconds
-window rootFull screen
import -window root -resize 1920x1080 -delay 2000 screenshot.png

feh Show pictures

Save modified files

If you want files to be saved when the --edit option is applied aptitude install libjpeg-turbo-progs which contains the commandline tools mentioned above
So do feh --edit file.jpg Any modification is saved when feh is closed

Modifing keybindings

KeyActionRemark
BackspaceShow previous file
Ctrl+DeleteDelete the file
< > RotationFrom Debian 10 Buster use --edit if you want the modified file to be saved
| _MirroringFrom Debian 10 Buster onwards use --edit if you want the modified file to be saved

Command examples

Show all pictures in a folder

feh --fullscreen --hide-pointer --draw-exif --draw-filename *
feh --geometry 800x450 --hide-pointer --draw-filename --edit --scale-down *

Show all pictures in a folder and all subfolders and scale to the sreen size

feh --recursive --scale-down *

Show all pictures in the folder in a 400×400 pixels window with a delay of 0.2 seconds once

feh --geometry 400x400 --slideshow-delay=0.2 --cycle-once

Errors

feh ERROR: Can't open X display. It *is* running, yeah?

Colors

xcolors - display all X11 color names and colors

convert (scale, resize)

CommandDescription
identify -format “%wx%h\n” *Show the size of all picutres in the current directory
convert test.png test.jpg
convert test.jpg -resize 600×400\> test.jpgConverts the image to a 600 x 400 image
convert test.png -resize 400 test400.pngConverts the image to a 400 width image while maintining the aspect ratio
convert '*.jpg[800x>]' item-%02d.jpg
Converts all .jpg files in the directory to files with a width of 800 while maintiaining the aspact ratio and changing the filename to something like item-03.jpg where the number counts from 00. If the width is 800 or less the image is not scaled
for i in `ls test*.png`; do basename1=`echo $i | \
cut -d \. -f 1`; convert $i -resize 400 \
$basename1.400.png; done
Convert multiple images named test*.png to a 400 pixel width and name them test*.400.png
for i in *.BMP; do convert $i "${i%.BMP}.png"; done
Convert all .BMP files in the directory to .png files
convert -resize x16 -gravity center -crop 16x16+0+0 \
-flatten -colors 256 -background transparent \
image.png favicon.ico
Convert image.png to a favicon of size 16 x 16 pixels
convert "filename.ext" -rotate 90 "filename-r.ext" ;

Contrast, brightness

convert -brightness-contrast 20x30 test.jpg testbricon.jpg
Increase the brightness with 20 and the contrast with 30

Convert

netpbm - package of graphics manipulation programs and libraries

Convert a pdf file made in RGB to CMYK with gs. This should work, it did not for us

gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \
-sOutputFile=output.pdf input.pdf

Convert a tiff file made in RGB to CMYK with Imagemagick's convert tool
Compression might be needed

convert source.tiff -colorspace CMYK -compress LZW destination.tiff

Optional commands

convert -list colorspace
convert -list compress

Merge

Merge two or more pdf files (example with 3 input files)

pdfunite file1.pdf file2.pdf fil3.pdf outfile.pdf

Crop

  • Install imagemagick
  • Run display imagefile.extension
  • You can zoom with the < and > keys
  • Left click in the image to open the menu. Rightclick gives an other menu
  • Select Transform | Crop
  • Crop the image
  • File | Save
  • Select a file name and change it as needed
  • Save
  • Enger JPEG quality 75 Save
  • File | Quit

display

Some keyboard accelerators for the display command:

KeyFunction
SpaceNext image
BackspacePrevious image
/Rotate by 90 degrees clockwise
\Rotate by 90 degrees counter clockwise
<Zoom out
>Zoom in
EscQuit

More on display keyboard accelerators

Create animated gif

GIF: Graphics Interchange Format

convert -delay 10 -loop 0 *.png file.gif

The default delay tick is 1/100 of a second. So 10 → 1/10 th of a second
For two seconds use 200 or 2/1
Loop 0 means infinite number of loops

Save picture from clipboard

xclip -selection clipboard -t TARGETS -o

Now save all, since the image can be multi layer, the image/something instances where something can be png, bmp, jpg, and so on

xclip -selection clipboard -t image/png -o > /tmp/image.png
xclip -selection clipboard -t image/bmp -o > /tmp/image.bmp

Webcam

fswebcam

Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
graphics_on_the_command_line.txt · Last modified: 29-02-2024 16:45 by wim