5/26/2016 - 11:20 AM

Image & PDF Conversion

Image & PDF Conversion

#! /bin/bash

# simply shrink JPG
convert -quality 90% -resize 1024x1024 image.jpg image_new.jpg # keeps aspect ratio: 1024x768! etc.

# Mogrify overwrites the given image file while convert puts it into another file

find . -type f -iname "*.jpg" -exec mogrify -verbose -resize 40% {} \;

convert -strip -interlace Plane -gaussian-blur 0.05 -quality 90% -resize ${JPG_SIZE}x${JPG_SIZE} ${JPG_FILES_2[@]} /tmp/kolhagen-cv-jpegs.pdf

pdfunite ${PDF_FILES_1[@]} /tmp/kolhagen-cv-jpegs.pdf ${PDF_FILES_3[@]} final/${OUTPUT_FILE}
pdftk ${PDF_FILES_1[@]} cat output merge.pdf

# Rotate, Rearrange etc.

# to simply reverse order of PDF document, print as file -> reverse -or- +rotate to right
pdftk in.pdf cat end-1right output out.pdf

# compress / shrink PDF file
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$dirname/$filename-reduced.pdf" "$1"

# EXIF data

# Remove all/specific EXIF data from image
exiftool -all= -overwrite_original -r .
# this will create a backup of the original
exiftool -gps= -geotag= photo.jpg

# Turn transparent background to color

convert image.png -background '#eaeaea' -alpha remove white.png

# '#eaeaea'; white; 'rgb(0,255,0)'

convert -page A3 -auto-orient
convert -page 1190x842 C-O-illustration-100.png illu.pdf

# Montage multiple images on one page
montage images-*.jpg -tile 2x1 assembly.pdf