In order to change the "gimp-comment" you must change a parasite that is
attached to the image. The following code defines a function that will
set the 'gimp-comment' parasite to the passed string. (Note: I don't
have access to the GIMP right now, so I haven't tested it; though I
think it will work.)
Include the function definition in your file (I recommend inserting it
right after the '(define (batch-test pattern)' line) and replace your
(set! gimp-comment "Some Test Text")
with
(add-comment image "Some Test Text")
;;----------------------------------------------------------
;; 'add-comment' attaches "gimp-comment" parasite to 'image'
;; with the value of the passed 'string'
;;
(define (add-comment image string)
(*catch 'errobj
(gimp-image-parasite-find image "gimp-comment")
(if (not (null? errobj))
(gimp-image-parasite-detach image "gimp-comment")
)
)
(gimp-image-parasite-attach (list "gimp-comment"
3
(bytes-append string)))
)
-----------------------------------
Quoting David Woodfall <[EMAIL PROTECTED]>:
> Hi,
>
> I'm trying to write a batch scm to insert a comment into a tiff. Here is
> the test code. It appears to function correctly but does not seem to add
> the comment:
>
> (define (batch-test pattern)
> (let* (
> (filelist (cadr (file-glob pattern 1)))
> (filename2)
> (filename)
> (image)
> (drawable)
> )
> (while filelist
> (set! filename (car filelist))
> (set! image (car (file-tiff-load RUN-NONINTERACTIVE filename
> filename)))
> (set! drawable (car (gimp-image-flatten image)))
> (set! gimp-comment "Some Test Text")
> (file-tiff-save RUN-NONINTERACTIVE image drawable "test.tif"
> "test.tif" 0)
> (gimp-image-delete image)
> (set! filelist (cdr filelist))
> )
> )
> )
>
> I have no idea if (set! gimp-comment "Some Test Text") is the right way of
> doing this but googling doesn't shed much light on it.
>
_______________________________________________
Gimp-user mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user