;;; Create a miniature version of an image. ;;; ;;; icon-web.scm ;;; ;;; Original version : ;;; Arch. Giuseppe Conte ;;; ;;; Version 0.1a by Raymond Ostertag : Changed menu entry ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Define the function: (define (script-fu-iconweb image drawable) (let* ( (owidth (car (gimp-image-width image))) (oheight (car (gimp-image-height image))) (nomefile (car (gimp-image-get-filename image))) ) ;;determina il fattore di scala (set! scx (/ 180 owidth)) (set! scy (/ 110 oheight)) (set! sc (if (<= scx scy) scx scy)) (set! sc (if (>= scx scy) scy scx)) (set! width (* sc owidth)) (set! height (* sc oheight)) (gimp-image-undo-disable image) (set! pos (string-search "." nomefile)) ;(gimp-message (number->string pos 10)) (set! prefisso (substring nomefile 0 pos)) ;(gimp-message prefisso) ;(set! filename (string-append prefisso ".png")) ;attacca l'estensione png e mantiene nome ed estensione del file originale per evitare confusione (set! filename (string-append nomefile ".png")) ;la riga seguente è corretta ;(set! filename (string-append (substring nomefile 0 (string-search "." nomefile)) ".png")) ;(gimp-message nomefile) ;(gimp-message filename) (set! newimage (car(gimp-channel-ops-duplicate image))) (gimp-image-scale newimage width height) ; (gimp-display-new newimage) (gimp-image-set-filename newimage filename) (set! newdrawable (car (gimp-image-active-drawable newimage))) ; (gimp-image-scale newimage width height) (gimp-displays-flush) ;;ottiene il nome del file modifica l'estensione in png e salva su file ;(set! imagename (string-append (car (gimp-image-get-filename image)) ".png")) ; (set! filename (car(gimp-image-get-filename image))) ; (set! filename (string-append (substring filename 0 (string-search "." filename)) ".png")) ;(gimp-message filename) (file-png-save 1 newimage drawable filename filename FALSE 6 FALSE TRUE TRUE TRUE TRUE) (gimp-file-save 1 newimage newdrawable filename filename) ; (gimp-displays-flush) )) (script-fu-register "script-fu-iconweb" "/Script-Fu/Utils/Save Thumbnail (iconweb)" "Crea una copia in miniatura di una immagine e la salva in formato *.png" "Arch. Giuseppe Conte (http://space.tin.it/edicola/lwcon/)" "Giuseppe Conte" "27 Aprile 2002" "RGB GRAY" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 )