Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > GIMP (GNU Image Manipulation Program) > Wrote a GIMP ex...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 2988 of 3073
Post > Topic >>

Wrote a GIMP extension to do scaling, EXACTLY what I want

by Ignoramus27711 <ignoramus27711@[EMAIL PROTECTED] > Jun 2, 2008 at 01:57 PM

This extension provides four functions for changing image size: 

1) Decrease size by 15%: ","
2) Increase size by 15%: "."
3) Decrease size 2x:     "Alt-,"
4) Increase size 2x:     "Alt-."

Then I defined four keyboard shortcuts mentioned in quotes above and
now I have the EXACT functions that I had in xv. 

I am a very happy GIMP user now, because I know that I can automate
what I do in the way I want. I have no clue about Scheme, but I am a
computer programmer and I can do "intelligent cut and paste from
google".

Source code follows:
######################################################################
;; Image rescaling. Copyright (C) Igor Chudov, Licensed under GPL 2.0
(define (script-fu-rescale img
                           factor
                           )
  ;; rescale

  (gimp-image-scale img 
                    (* (car (gimp-image-width img)) factor)
                    (* (car (gimp-image-height img)) factor)
                    )
  ;; Flush the display
  (gimp-displays-flush)
)

(define (script-fu-rescale-up img) 
  (script-fu-rescale img 1.15)
)
(define (script-fu-rescale-down img) 
  (script-fu-rescale img 0.8695)
)

(define (script-fu-rescale-up2x img) 
  (script-fu-rescale img 2)
)
(define (script-fu-rescale-down2x img) 
  (script-fu-rescale img 0.5)
)

(script-fu-register "script-fu-rescale-up"
                    "Rescale Up 15%"
                    "Rescale Up 15%"
                    "Igor Chudov"
                    "Igor Chudov"
                    "2008"
                    "RGB*, GRAY*"
                    SF-IMAGE    "Image"         0
                    )
(script-fu-menu-register "script-fu-rescale-up"
                         "<Image>/Script-Fu/Rescale")

(script-fu-register "script-fu-rescale-down"
                    "Rescale Down 15%"
                    "Rescale Down 15%"
                    "Igor Chudov"
                    "Igor Chudov"
                    "2008"
                    "RGB*, GRAY*"
                    SF-IMAGE    "Image"         0
                    )
(script-fu-menu-register "script-fu-rescale-down"
                         "<Image>/Script-Fu/Rescale")

;;;;;;;;;;;;;;;;;;;;;;;;;;;

(script-fu-register "script-fu-rescale-up2x"
                    "Rescale Up 2X"
                    "Rescale Up 2X"
                    "Igor Chudov"
                    "Igor Chudov"
                    "2008"
                    "RGB*, GRAY*"
                    SF-IMAGE    "Image"         0
                    )
(script-fu-menu-register "script-fu-rescale-up2x"
                         "<Image>/Script-Fu/Rescale")

(script-fu-register "script-fu-rescale-down2x"
                    "Rescale Down 2X"
                    "Rescale Down 2X"
                    "Igor Chudov"
                    "Igor Chudov"
                    "2008"
                    "RGB*, GRAY*"
                    SF-IMAGE    "Image"         0
                    )
(script-fu-menu-register "script-fu-rescale-down2x"
                         "<Image>/Script-Fu/Rescale")

-- 
   Due to extreme spam originating from Google Groups, and their
inattention 
      to spammers, I and many others block all articles originating 
       from Google Groups. If you want your postings to be seen by 
         more readers you will need to find a different means of 
                       posting on Usenet.
                   http://improve-usenet.org/
 




 2 Posts in Topic:
Wrote a GIMP extension to do scaling, EXACTLY what I want
Ignoramus27711 <ignora  2008-06-02 13:57:19 
Re: Wrote a GIMP extension to do scaling, EXACTLY what I want
Dirk Hartmann <blangis  2008-06-25 01:23:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Sep 5 23:34:07 CDT 2008.