Advertisement
Guest User

Untitled

a guest
May 28th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #!/bin/bash
  2. {
  3. cat <<EOF
  4. (define
  5. (crop-note-image filename outfile)
  6. (let*
  7. (
  8. (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
  9. (drawable (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
  10. )
  11.  
  12. ;rotate
  13. ; (drawable, angle(radians), auto-center, center-x, center-y, interpolate, clip-result)
  14. ; clip-result:TRANSFORM-RESIZE-ADJUST (0), TRANSFORM-RESIZE-CLIP (1), TRANSFORM-RESIZE-CROP (2), TRANSFORM-RESIZE-CROP-WITH-ASPECT (3)
  15. ;(gimp-drawable-transform-rotate-default drawable 1 0 0 0 1 2)
  16.  
  17. ;(image, new-width, new-height, offx, offy)
  18. ;(gimp-image-crop image 3200 4880 310 60)
  19.  
  20. ;(gimp-image-convert-grayscale image)
  21.  
  22. ;downsampling
  23. ;(gimp-image-scale image (/ (car (gimp-image-width image)) 2) (/ (car (gimp-image-height image)) 2))
  24. ;(gimp-image-set-resolution image 300 300)
  25.  
  26. ;Convert to indexed color range
  27. ; (image, dither-type, PALETTE-TYPE, NUM-COLs, alpha-dither, remove-unused, palette)
  28. ; PALETTE-TYPE: MAKE-PALETTE (0), MONO-PALETTE (3)...
  29. (gimp-image-convert-indexed image 0 3 0 FALSE 0 "")
  30.  
  31. ;save to png
  32. ;(file-png-save-defaults RUN-NONINTERACTIVE image drawable outfile outfile)
  33.  
  34. ;save to tiff
  35. (gimp-layer-flatten drawable)
  36. (file-tiff-save RUN-NONINTERACTIVE image drawable outfile outfile 6)
  37.  
  38. ;save to jpeg
  39. ;(file-jpeg-save 1 image drawable outfile outfile 0.85 0 1 0 "" 0 0 0 0)
  40. (gimp-image-delete image) ; ... or the memory will explode
  41. )
  42. )
  43.  
  44. (gimp-message-set-handler 1) ; Messages to standard output
  45. EOF
  46.  
  47. #for i in extractpdf/*.pbm; do
  48. echo "(gimp-message \"$1\")"
  49. echo "(crop-note-image \"$1\" \"${1}.tif\")"
  50. #done
  51.  
  52. echo "(gimp-quit 0)"
  53. } | gimp -i -b -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement