Re: [Gimp-developer] Script-Fu/Scheme---what is #f

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon Roland Roberts ([EMAIL PROTECTED]) wrote:
 I'm trying to write write a script-fu to automatically take a
 finished image and produce a set of scaled images for display
 on a web site.  The learning curve for this is rather steep

Simon If it is just about scaling and/or do simple adjustments to
Simon the image you might want to look at the imagemagick
Simon tools. Usually these are better for simple tasks and the
Simon learning curve for these is not steep at all.

I haven't played with ImageMagick, so I'm not sure how good a job it
does when rescaling.  I've been using the GIMP because it's
downsampled images look pretty good, at least as compared to using the
netpbm tools.

Plus, I do most of my final editing in the GIMP---I create a set of
layers that overlay information onto the base image to be used as a
web rollover (see, for example,
http://www.astrofoto.org/gallery/constellations/view.html?con=her for
a recent example).  Since I'm already working in the GIMP, I figured
I'd just add the feature there rather than have to fire up another
tool.  I already have to do preliminary photo adjustments with a
Windoze tool (Picture Works Pro) since I want to work with
16-bits/color until near the end.

Scheme is not the problem, per se (hey! I learned Scheme 20 years ago
sitting in class with Abelson and Sussman *before* they printed the
book).  It's all the GIMP stuff and the SIOD idioms that keep tripping
me.  That and 20 years of messing more Emacs lisp than Scheme

 There appears to be an idiom that I can't figure out, a series
 of lines like this:

 (original-layer-for-darker #f)

 what is the #f?

Simon Just a shortcut for '(), or FALSE. #t would be 1 or TRUE.
Simon However, I think these values are not used at all. They
Simon appear in the declaration of variables and are unused
Simon default values.

Okay, thanks.  I'm not sure why the author did that; I would have just
written

(let* ((...)
   original-layer-for-darker ...)

Anyway, I have the basic rescaling of a copy working and it loops over
the set of sizes I specify.  I'm now adding code to copy all of the
layers instead of just the background layer as well as to copy layer
attributes correctly.  I figured out, by trial and error, that
whatever it was wasn't important for me.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



[Gimp-developer] Script-Fu error ... GUI shows different image selection than what script gets

2002-09-05 Thread Roland Roberts

I have a script-fu set up which has the following initialization:

(script-fu-register script-fu-astro-rescale-for-web
Toolbox/Xtns/Script-Fu/Astronomy/Scale for Web
Rescale current image to \standard\ sizes for web display
Roland B. Roberts [EMAIL PROTECTED]
Roland B. Roberts [EMAIL PROTECTED]
4 September 2002

SF-IMAGE Image 0
SF-VALUE Size List '(1600 1280 1024 800 640 320 160))

When the script is run by selecting it from the menu, an option list
is presented which shows the current (and only, in this case) as
selected.  If I simply hit Okay, I get the following error:

Script-Fu Error while executing (script-fu-astro-rescale-for-web 0 '(320))
ERROR: Procedural database executinog failed: (gimp_image_width 0)

The problem is that my image is *not* image 0.  It is image 5.  I
realize I have 0 as a default and most of the time that will probably
make sense.  But why is it showing me image 5 in the option list and
then not using it.  If I click on the option list and select the
only image showing, it works correctly.

Also, I tried evaluating (gimp-image-list) in the Script-Fu console
and there really is only one image; i.e., I don't have any invisible
ones hanging around.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] gimp-drawable-type doesn't work on images?

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon I have not yet checked the problem you mentioned in your
Simon other Mail, it might very well be a bug.
[...]

Simon However, you can easily avoid this problem by moving the
Simon menu entry to Image/foo/bar/baz and registering your
Simon script with a SF_IMAGE and a SF_DRAWABLE as the first two
Simon arguments. Then you have easily access to the image the
Simon user invoked the script in and the current active drawable
Simon of this image.

Yes, I could do that, but I think that will confuse the interface
since I do not wish to copy only a particular drawable; I want to copy
the entire image.  On the other hand, the only person likely to be
using this for the foreseeable future is me

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] Script-Fu error ... GUI shows different image selection than what script gets

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon [...] There is no real concept of a active image. This is
Simon the primary reason, why there is no save entry in the
Simon toolbox menu.

Simon If you register your script in the context menu of the
Simon image (Image) you always get the image/drawable the user
Simon operates on as the first parameter.

Thanks.  This makes sense and, in fact, it really makes more sense to
put my script in either the image or file context menu since I want it
to both rescale and save the results.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] gimp-drawable-type doesn't work on images?

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon You can determine the global image type via
Simon (gimp-image-base-type ...)  but be aware that the the
Simon values returned are not compatible with the values returned
Simon by gimp-drawable-type.

Thanks, I thought I had searched the the PDB for type but I guess
not or I would have found that.  (gimp-image-base-type ...) is exactly
what I need.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] copy-paste-anchor shifting my position

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon Roland Roberts ([EMAIL PROTECTED]) wrote:
 I'm trying to copy a layer from one image to another.  Below is a
 fragment of the code to do this; new-image has already been created
 with the same base type as the old-image.
 
Simon [...]
 (gimp-selection-all old-image)
 (gimp-edit-copy old-layer)

Simon It *might* (just tested with the GUI) be a better idea to
Simon use (gimp-selection-none old-image),  [...]

Thanks for this suggestion.  It turns out that using
gimp-selection-none on both the old and new images gets things pasted
into the right locations.

Simon Also you might want to use gimp-floating-sel-to-layer and
Simon use (gimp-layer-set-offsets ..) on this newly created
Simon layer. [...]

Naively using this results in twice as many layers as what I started
with.  And gimp-floating-sel-to-layer is documented to return nothing,
so I'm not sure how I am supposed to find the newly created layer.
Maybe I should have used gimp-selection-float to create the layer?

In any event, just removing the selection from both images results in
an exact copy.

Simon However, it is an annoyance that gimp-layer-copy restricts
Simon the usage of the result to the originating image. [...]

I agree...I first thought that was exactly what I wanted until I read
the comments to realize I could only copy within an image.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



[Gimp-developer] No programmatic undo?

2002-09-05 Thread Roland Roberts

Is there any way to programmatically undo a set of operations?

I want to take and resize an image.  To do so, I currently copy it
repeatedly, flatten, resize, and save.  The copy/flatten is
time-consuming.  I thought I could do that one, do the resize and
save, undo the resize and then resize to the new scale.

But I can't find any programmatic way to undo my operations.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer