Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- {
- cat <<EOF
- (define
- (crop-note-image filename outfile)
- (let*
- (
- (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
- (drawable (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
- )
- ;rotate
- ; (drawable, angle(radians), auto-center, center-x, center-y, interpolate, clip-result)
- ; clip-result:TRANSFORM-RESIZE-ADJUST (0), TRANSFORM-RESIZE-CLIP (1), TRANSFORM-RESIZE-CROP (2), TRANSFORM-RESIZE-CROP-WITH-ASPECT (3)
- ;(gimp-drawable-transform-rotate-default drawable 1 0 0 0 1 2)
- ;(image, new-width, new-height, offx, offy)
- ;(gimp-image-crop image 3200 4880 310 60)
- ;(gimp-image-convert-grayscale image)
- ;downsampling
- ;(gimp-image-scale image (/ (car (gimp-image-width image)) 2) (/ (car (gimp-image-height image)) 2))
- ;(gimp-image-set-resolution image 300 300)
- ;Convert to indexed color range
- ; (image, dither-type, PALETTE-TYPE, NUM-COLs, alpha-dither, remove-unused, palette)
- ; PALETTE-TYPE: MAKE-PALETTE (0), MONO-PALETTE (3)...
- (gimp-image-convert-indexed image 0 3 0 FALSE 0 "")
- ;save to png
- ;(file-png-save-defaults RUN-NONINTERACTIVE image drawable outfile outfile)
- ;save to tiff
- (gimp-layer-flatten drawable)
- (file-tiff-save RUN-NONINTERACTIVE image drawable outfile outfile 6)
- ;save to jpeg
- ;(file-jpeg-save 1 image drawable outfile outfile 0.85 0 1 0 "" 0 0 0 0)
- (gimp-image-delete image) ; ... or the memory will explode
- )
- )
- (gimp-message-set-handler 1) ; Messages to standard output
- EOF
- #for i in extractpdf/*.pbm; do
- echo "(gimp-message \"$1\")"
- echo "(crop-note-image \"$1\" \"${1}.tif\")"
- #done
- echo "(gimp-quit 0)"
- } | gimp -i -b -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement