sh 图像和PDF转换

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 图像和PDF转换相关的知识,希望对你有一定的参考价值。

#! /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)'


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

以上是关于sh 图像和PDF转换的主要内容,如果未能解决你的问题,请参考以下文章

sh 按文件名顺序将图像转换为PDF,文本前缀和数字后缀,如Untitled-0.jpg,Untitled-1.jpg等。

sh 将PDF文件转换为PNG,JPEG,TEXT和HTML文件

从 pdf 和 word 转换为图像

怎么用ABBYY将PDF转换为JPEG图像

sh 将PDF转换为png

sh 将pdf转换为jpg