PDA

Vollständige Version anzeigen : Webotine


Hadey2
03.10.2004, 16:18
Hallo,
ich versuche bei meiner Gimp-Version (2.0 , Linux) das Plug-in: Webotine einzubinden.
Beim ausführen kommt allerdings eine Fehlermeldung:

Error while executing
(script-fu-webotine 1 2 "webotine.html" "." "webotine" "" 0 0 2 FALSE FALSE)
ERROR: unbound variable (errobj gimp-channel-ops-duplicate)

Da ich noch nie etwas mit Script-Fu gemacht habe, weiss ich natürlich auch nicht wie ich das verbessern kann.
Hat jemand eine Lauffähige Version davon, oder eine Alternative?
Das Plugin soll Ein Bild entlang der Hilfslinien zerschneiden, und daraus dann eine HTML-Datei machen. (PS: "slicen" )
Für Hilfe bin ich dankbar :wink:

Rebell
03.10.2004, 17:30
Rufst du's über den Plugin Browser auf, oder aus dem Menü?

Hadey2
03.10.2004, 17:42
Ich mache es so:
-> Rechte Maustaste -> ScriptFu ->Web -> Webotine

Ich denke, das meinst du mit Menü. Was du mit Plugins Browser meinst, weiss ich nicht :?:

Rebell
03.10.2004, 22:30
Welches Linux benutzt du denn? Benutzt du jenes, was dirrekt von der Software Installation kommt oder hast du dir es von woanders hergeholt?

klaus_harrer
04.10.2004, 07:14
Hallo

Ich finde das Script auch nicht. Welche Gimp Version benutzt du?
Und wen möglich poste das Script oder schickes es mir per e-Mail. Denn von einer "gimp-channel-ops-duplicate" habe ich bis jetzt noch nicht gehört.

MfG
Klaus

Hadey2
04.10.2004, 11:53
Bei dem betroffenden System habe ich Suse 9.1 installiert.
Dort wurde standardmäßig Gimp mitinstalliert, nämlich die Version 2.0.0 .
Das Plugin "Webotine" war nicht standardmäßig dabei, wurde hier im Forum aber empfohlen, um Designs zu "slicen".

Von dort habe ich es runtergeladen:
http://registry.gimp.org/plugin?id=2821


; webotine.scm
; Author: Jason Austin <jason@jasononthe.net>
; Version: 1.0
;
; License:
;
; 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.
;
; The GNU Public License is available at
; http://www.gnu.org/copyleft/gpl.html
;
;
; $Id: webotine.scm,v 1.1 2004/05/14 13:07:56 jaustin Exp $
; $Name: $
;
; This script takes an image, cuts it up on the guides, and then
; produces the sub-images and HTML to display the image in a table. It
; is a script-fu rewrite of perlotine by Seth Burgess <sburges@gimp.org>
; The main reason for the re-write is so it will work on the Windows
; version that doesn't currently have perl support.
;
; Usage Notes:
;
; Image slices are taken only from the active layer which doesn't
; necessarily need to be visible. This could cause some confusing
; results.
;
; The relative path is the pathname you want pre-pended to the image
; filenames in the HTML file. Make sure to include the trailing file
; separator. And example would be "/images/".
;
; The "full document" option produces a full HTML document that can be
; immediately loaded into a browser. This makes development a bit
; quicker. If it's not checked, only the table section is produced
;
; If you select "gif" on a Windows system with the default Gimp
; distrbution, you'll get an ugly error, since it doesn't contain gif
; support.
;
; I made up image save settings using common defaults. A possible
; improvement would be to add these to the dialog window.
;

;;
;; Get a list of guides of a given orientation
;;
(define (script-fu-webotine-guides image guide orientation)
(if (not (= guide 0))
(if (= (car (gimp-image-get-guide-orientation image guide))
orientation)
(append (gimp-image-get-guide-position image guide)
(script-fu-webotine-guides
image
(car (gimp-image-find-next-guide image guide))
orientation))
(script-fu-webotine-guides
image (car (gimp-image-find-next-guide image guide))
orientation)
)
)
)

;;
;; From a list of guides, create a list of coordinate pair lists for
;; the image slices.
;;
(define (script-fu-webotine-slices cur-point last-point middle-points)
(if (null? middle-points)
(cons (list cur-point last-point))
(cons (list cur-point (car middle-points))
(script-fu-webotine-slices
(car middle-points) last-point
(cdr middle-points)))
)
)

;;
;; Print indent characters as needed for the given indent-level
;;
(define (script-fu-webotine-html-indent fh indent-type indent-spaces
indent-level)
(let ((i 0) (j 0))
(while (< i indent-level)
(if (= indent-type 0)
(begin
(set! j 0)
(while (< j indent-spaces)
(fwrite " " fh)
(set! j (+ j 1))))
(fwrite "\t" fh))
(set! i (+ i 1)))
)
)


;;
;; Print the header HTML for a full document generate
;;
(define (script-fu-webotine-html-header fh indent-type indent-spaces
html-caps)
(fwrite "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
fh)
(if (= html-caps TRUE) (fwrite "<HTML>\n" fh) (fwrite "<html>\n" fh))
(script-fu-webotine-html-indent fh indent-type indent-spaces 1)
(if (= html-caps TRUE) (fwrite "<HEAD>\n" fh) (fwrite "<head>\n" fh))
(script-fu-webotine-html-indent fh indent-type indent-spaces 2)
(if (= html-caps TRUE) (fwrite "<TITLE></TITLE>>\n" fh)
(fwrite "<title></title>\n" fh))
(script-fu-webotine-html-indent fh indent-type indent-spaces 1)
(if (= html-caps TRUE) (fwrite "</HEAD>\n" fh) (fwrite "</head>\n" fh))
(script-fu-webotine-html-indent fh indent-type indent-spaces 1)
(if (= html-caps TRUE) (fwrite "<BODY>\n" fh) (fwrite "<body>\n" fh))
2
)

;;
;; Print the trailing HTML for a full document generation
;;
(define (script-fu-webotine-html-trailer fh indent-type indent-spaces
html-caps)
(script-fu-webotine-html-indent fh indent-type indent-spaces 1)
(if (= html-caps TRUE) (fwrite "</BODY>\n" fh) (fwrite "</body>\n" fh))
(if (= html-caps TRUE) (fwrite "</HTML>\n" fh) (fwrite "</html>\n" fh))
)

;;
;; Create an image slice and print the <td> and <img> tags to display
;; it
;;
(define (script-fu-webotine-make-image fh image image-base
image-dir image-rel-dir image-ext
html-caps horiz vert hpos vpos)
(let* (
(image-ext-str (if (= image-ext 0) "jpg"
(if (= image-ext 1) "gif" "png")))
(image-file (string-append image-dir "/" image-base "-"
(number->string hpos 10) "-"
(number->string vpos 10) "."
image-ext-str))
(image-rel-file (string-append image-rel-dir image-base "-"
(number->string hpos 10) "-"
(number->string vpos 10) "."
image-ext-str))
(temp-image (car (gimp-channel-ops-duplicate image)))
(image-width (- (cadr horiz) (car horiz)))
(image-height (- (cadr vert) (car vert)))
(layer (car (gimp-image-get-active-layer temp-image)))
)
(gimp-crop temp-image image-width image-height
(car horiz) (car vert))
;; JPG
(if (= image-ext 0)
(file-jpeg-save 1 temp-image layer image-file image-file 0.75
0.0 1 0 "Created with Web-O-Tine" 0 1 0 0))
;; GIF
(if (= image-ext 1)
(begin
(gimp-convert-indexed temp-image 1 0 255 0 0 "")
(file-gif-save 1 temp-image layer image-file image-file 0
0 0 0)))

;; PNG
(if (= image-ext 2)
(file-png-save 1 temp-image layer image-file image-file 0 6 1
0 0 1 1))
(gimp-image-delete temp-image)

(if (= html-caps TRUE)
(fwrite (string-append "<TD><IMG SRC=\"" image-rel-file
"\" WIDTH=\""
(number->string image-width 10)
"\" HEIGHT=\""
(number->string image-height 10)
"\"></TD>") fh)
(fwrite (string-append "<td><img src=\"" image-rel-file
"\" width=\""
(number->string image-width 10)
"\" height=\""
(number->string image-height 10)
"\"></td>") fh)
)
)
)

(define (script-fu-webotine image layer html-file image-dir image-base
image-rel-dir image-ext indent-type
indent-spaces html-caps full-document)
(let* (
(fh (fopen html-file "w"))
(grid (list (script-fu-webotine-slices
0 (car (gimp-image-width image))
(qsort (script-fu-webotine-guides
image (car (gimp-image-find-next-guide image 0))
VERTICAL) <))
(script-fu-webotine-slices
0 (car (gimp-image-height image))
(qsort (script-fu-webotine-guides
image (car (gimp-image-find-next-guide image 0))
HORIZONTAL) <))))
(indent-level 0)
(hpos 0)
(vpos 0)
)
(if (= full-document TRUE)
(set! indent-level (script-fu-webotine-html-header
fh indent-type indent-spaces
html-caps)))
(script-fu-webotine-html-indent fh indent-type indent-spaces indent-level)
(if (= html-caps TRUE)
(fwrite "<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n" fh)
(fwrite "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" fh))
(set! indent-level (+ indent-level 1))
(mapcar (lambda (v)
(set! hpos (+ hpos 1))
(set! vpos 0)
(script-fu-webotine-html-indent fh indent-type
indent-spaces
indent-level)
(if (= html-caps TRUE)
(fwrite "<TR>\n" fh) (fwrite "<tr>\n" fh))
(set! indent-level (+ indent-level 1))
(mapcar (lambda (h)
(set! vpos (+ vpos 1))
(script-fu-webotine-html-indent fh indent-type
indent-spaces
indent-level)
(script-fu-webotine-make-image fh image image-base
image-dir
image-rel-dir
image-ext
html-caps h v
hpos vpos)
(fwrite "\n" fh)
) (car grid))
(set! indent-level (- indent-level 1))
(script-fu-webotine-html-indent fh indent-type
indent-spaces
indent-level)
(if (= html-caps TRUE)
(fwrite "</TR>\n" fh) (fwrite "</tr>\n" fh))
) (cadr grid))

(set! indent-level (- indent-level 1))
(script-fu-webotine-html-indent fh indent-type indent-spaces indent-level)
(if (= html-caps TRUE) (fwrite "</TABLE>\n" fh) (fwrite "</table>\n" fh))

(if (= full-document TRUE)
(script-fu-webotine-html-trailer
fh indent-type indent-spaces
html-caps))
(fclose fh)
)
)



(script-fu-register "script-fu-webotine"
"<Image>/Script-Fu/Web/Web-O-Tine"
"Web-O-Tine"
"Jason Austin <jaustin@jasononthe.net>"
"Jason Austin"
"2003"
""
SF-IMAGE "Image to use" 0
SF-DRAWABLE "Drawable to draw grid" 0
SF-FILENAME "HTML File" "webotine.html"
SF-FILENAME "Image Directory" "."
SF-STRING "Image Base Name" "webotine"
SF-STRING "Relative Image Directory" ""
SF-OPTION "Image Extension" '("jpg" "gif" "png")
SF-OPTION "Indent Type" '("spaces" "tabs")
SF-ADJUSTMENT "Indent Spaces" '(2 0 10 1 1 0 0)
SF-TOGGLE "Capitalize HTML Tags?" FALSE
SF-TOGGLE "Full HTML Document?" FALSE
)


Danke für eure Mühe :wink:

Rebell
04.10.2004, 14:14
Ich hab gerade das hier verwendet:

http://registry.gimp.org/plugin?id=2821

Und es funktioniert wunderbar (Gimp 2.0.2).

Schau mal ins Yast und such nach "Gimp". Eventuell fehlt noch irgendein zusätzliches Gimp-Paket was dir Suse nicht installiert hat.

Hadey2
04.10.2004, 18:15
Danke... :wink:
Hat zwar nix gebracht, aber mit meiner rabiaten Art habe ich es einfach komplett deinstalliert und anschließend selber kompiliert. Jetzt funktioniert es :)

Ich habe aber noch ein paar Fragen, im Bezug auf die Benutzung von Gimp.. ich stelle sie einfach mal hierhin:

gibt es:

- eine Funktion, die eine Auswahl umkehrt ?
- eine Funktion, mit der ich eine Auswahl in eine neue Ebene kopieren kann?
- eine Möglichkeit, die Auswahl zu verkleinern? (bspw. um 1 Pixel)

Außerdem klappt es bei mir nie mit den Shortcuts... zwar kann ich verschiedenen Funktionen neue Shortcuts zuweisen (indem ich sie im Menü markeire und dann eine Bestimmte Tastenkombination drücke), allerdings funktionieren sie dann nicht :(

Agrajag
04.10.2004, 18:34
Schau dir doch einfach mal die Menüpunkte an.

Menü Auswahl -> Invertieren (Strg+i)
Menü Auswahl -> Verkleinern

Eine relativ schnelle Methode, eine Auswahl auf eine neue Ebene zu bringen:
Auswahl erstellen; Strg+C; Strg+V; => neue "schwebende Auswahl" ist im Ebenendialog sichtbar; darauf mit rechter Maustaste und "neue Ebene" wählen; fertig.

Shortcuts: Ich kann mich erinnern, dass auch ich bei 2.0.0 Probleme mit den Shortcuts hatte. Eine Lösung dazu ist mir nicht bekannt. Aber seit ich 2.1.4 verwende, ist das kein Thema mehr. Ich kann jetzt sogar endlich per Tasten die Pinsel durchschalten. Yay! =)

klaus_harrer
06.10.2004, 07:33
Hallo

Ich weiss warum webotine nicht bei deiner Gimpversion funktioniert hat. Das liegt daran das sich Script-fu von Syntax her auch von Version zu Version sich verändern kann, b.z.w sich weiterentwickelt.

Im Klartext:

Wenn man Webotine unter Gimp-2.0.0 und tiefer nutzen möchte, sollte man im Script webotine.scm

"gimp-channel-ops-duplicate" zu "gimp_image_duplicate"

verändern.

Da ich jetzt aber meine Linux Distri aktualisiert habe , bin ich nun stolzer Besitzer von Gimp-2.0.4. Wer noch Gimp-2.0.0 hat kann mir mal ein Feedback geben ob es so funktioniert.

MfG
Klaus