Skip to content


Resize Image In Context Menu

In my last post, I write an article about using gimp script to generate the watermark on images. At last I add the watermark command on the context menu. Today I will introduce another useful script: resize.

The script I changed come from http://www.adp-gmbh.ch/misc/tools/script_fu/, the author also collect many useful gimp scripts.  The changed script ‘rs-resize.scm’ is here:

(define (script-fu-rs-resize filename new-width new-height)
  (let* ((image    (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
         (drawable (car (gimp-image-active-drawable image)))
        )
 
     (gimp-image-scale image new-width new-height)
     (gimp-file-save   RUN-NONINTERACTIVE image drawable filename filename)
  )
)

You should copy it into “D:\Program Files\GIMP-2.0\share\gimp\2.0\scripts”(If your GIMP installed at D:\Program Files\GIMP-2.0 ), then we write the bat file ‘rs-resize.bat’:

set str=%1
set str=%str:\=/%
"D:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i --verbose -b "(script-fu-rs-resize \"%str%\" 200 120)" -b "(gimp-quit 0)"

The ‘200′ is the width, and the ‘120′ is the height. I use this size because my blog needs this size. Then we should add this bat into context menu , so you can write an ‘rs-resize.reg’, and run it.

Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpResize]
@="Shrink to 200*120"
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpResize\command]
@="F:\\rocksun\\gimp-script\\rs-resize\\rs-resize.bat \"%1\""

Of course, you should edit the menu name ‘Shrink to 200*120′ according to your content. This picture below is resized and added a watermarks. It looks not good, but you can make better after change the font and size.

Winter

Winter

All files you can download or checkout from http://gimp-script.googlecode.com/svn/trunk/rs-resize/ . I create this project to collect and produce gimp script, you can join it.

Related posts:

  1. Gimp Crop Script
  2. FTP image with Conext Menu
  3. RockSun的script-fu教程
  4. Watermark: With GIMP Script
  5. 自己动手简化图片处理

Posted in blog. Tagged with , , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.