February 21, 2008

GIMP Screenshot Processor (Script-Fu)

They say a picture is worth a thousand words. In that vain, rather than describe something on your computer display in words, it is often more effective to use a screenshot. However, raw screenshots can be cumbersome.

The image processing I use to make a raw screenshot easier to handle and view is straightforward:
  1. Scale down (shrink) the image by 80%
  2. Run the sharpen filter to make the text more readable
  3. Reduce the palette to 256 colors to take less space
  4. Add a border to make the image standout
  5. Save the image as a PNG file for universal viewing
The image processing is easy in most graphics editors, but it is rather tedious if you are making lots of screenshots. If you use the Open Source (free) graphics editor GIMP, you can write a script to automatically perform the steps.

; GIMP Screenshot Processor v1.2 (Script-Fu)
(define (screenshot-processor img draw)
(gimp-image-scale img ;Shrink image 80%
(* (car (gimp-image-width img)) 0.8)
(* (car (gimp-image-height img)) 0.8))
(plug-in-sharpen TRUE img draw 25) ;Sharpen image
(gimp-image-convert-indexed img ;Reduce colors to 256
1 0 256 FALSE TRUE "")
(script-fu-addborder img draw ;Add 4px border
4 4 '(128 128 128) 0)
(gimp-image-flatten img) ;Convert to single layer
)
(script-fu-register
"screenshot-processor" "Screenshot Processor"
"Shrinks, sharpens, reduces color, and adds border to current image."
"Dem Pilafian, Center Key Software"
"Public Domain" "October 5, 2008" ""
SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0)
(script-fu-menu-register "screenshot-processor" "<Image>/Tools")

Steps to Install:
1) Download script and save it as: screenshot-processor.scm
2) Copy file to folder: <installfolder>/GIMP-2.0/share/gimp/2.0/scripts/
3) Filters → Script-Fu → Refresh Scripts


Now you are ready to take your screenshot (in Microsoft Windows: <Ctrl-PrintScreen> or <Alt-PrintScreen>).

Steps to Run:
1) Create new image by pasting screenshot into GIMP
2) Tools → Screenshot Processor
3) File → Save → Name: screenshot.png → Save → Save

The result is a convenient screenshot image file that is appropriate for sending in an e-mail.


0 comments: