On Fri, Oct 28, 2005 at 07:34:11PM +0200, Mauro Condarelli wrote:
> > On Thu, Oct 27, 2005 at 11:46:52AM +0200, Mauro Condarelli wrote:
> I had a look to the script-fu docs and I sincerely have some
> problems orienting in there.
> First the good news: I have little problems with scheme, after
> several thousand lines of elisp hacking.
> ..then the problems: I have problems finding the "right way"
> to do things. I browsed the available procedures (Xtns->Procedure Browser),
> but I did *not* find everything I need (see below).
i am more familiar with python but the two have the same capabilities,
for the most part -- as far as gimp is concerned.
The script-fu console has a browse button, i highly recommend this for
looking over the gimp procedures with.
> What I would like to do is:
> 1) start some script and create a new layer for the translation
> (ok, I should be able to do that)
this is not a one step process. everytime i write a script that does
this, it is one of the points where there can easily be breakage. maybe
i will put my adding a layer with a python script on my web journal
> 2) wait for a mouse click somewhere (I didn't find a way to do that)
> I will click on the white area of some comics text bubble.
i don't know how to do this with python short of involving pygtk. i do
not think there is an equivelent to pygtk with script-fu.
there is no run-interactive ability with gimp scripting right now.
> 3) get the coordinates of the pixel clicked (don't know how to do that)
easy with c. with scripts it is more that you tell where to get
information from, such as fuzzy select:
(gimp-fuzzy-select drawable x y threshold operation antialias feather
where x and y are the coordinates of initial seed fill point: (image
if text balloons are the only white parts on the images, select by color
might be something to think about.
you can get the area of a selection via scripting:
(gimp-selection-bounds image) returns x1, y1, x2, y2
> 4) start the magic-wand with the mouse click coordinates (gimp_fuzzy_select)
an interactive plug-in like this would need to be written in c or would
need the help of a wrapped set of widgets to script with, like pygtk --
i mentioned this already.
> 5) remove the inner "holes" in the selection due to the text to be erased.
> I found a less-than-satisfactory way of doing that using
> (gimp_selection_grow img 7)(gimp_selection_shrink img 8).
> I would like to do it algorythmically, but I have no idea which
> procedures to use.
consider after removing the white parts, inverting the selection
(gimp-selection-invert image) to get rid of the text.
> 6) move the selection to the translation layer
> (gimp_image_add_channel tlayer (gimp_selection_save img) 0) (???)
(gimp-selection-float drawable offx offy) i think if you use x1 and y1
from (gimp-selection-bounds image) it will work. then make a new layer
> 7) clear the selection (in translation layer)
> (gimp_context_set_background (gimp_image_pick_color img clickX clickY))
> (gimp_drawable_fill (gimp_selection_save img) GIMP_BACKGROUND_FILL)
if you make sure the layer transparency is toggled
(gimp-layer-set-lock-alpha layer lock-alpha) you should be able to fill
the original pixel region without a lot of extra steps. to do this,
float your selection first and make that into a new layer. then invert
the selection and fill that. then toggle the transparency and fill the
> 8) open a box to edit text and then render it to the new selection in tlayer
> (gimp_textget_extens_fontname)/(gimp_text_fontname) ??
> How do I get the dimensions of the "useful" area?
> How do I get the text inteh first place? I would need some kind
> of text input box, but I found nothing :(
no input boxen are available, but i have explained this already. what
is available is the means to calculate the text area and adjust the font
> > > 4) Edit a (possibly long) string and fit it into the cleared
> > region (eventually scaling the font to make it fit).
> > >
> > via scripts, there are many many ways to control text. you can
> > see this
> > if you look at Xtns-->PDB Browser and search for text.
> I found nothing.
> Only low level procedures to actually render a string.
> No way to edit it.
it will take some medium level math.
and gimp only works on its own text layers. i think that what you want
to do cannot be done with gimp. when you make a text layer, the string
is available to be read by gimp, however. maybe future projects can
make use of this.
> > the text is on its own layer anyways.
> How it comes?
> I want it to be in its own layer, but I only found ways to render text,
> no way to save the ascii (or unicode) version of it.
> What am I missing?
gimp only works with its own text. you could keep the text that you
would like to be rendered in a text file and read from this and render
it into a gimp text layer -- especially if your images are saved with
logical names like img_001.png.... each line in the text file could
coorespond with the image.
it is the best you are going to get with this gimp.
> > > I need this in order to translate some comics I scanned.
> > each different color might need a different threshold setting.
> > > I want to automatise as much as possible the process. Doing
> > it completely manually is impossibly long (for me).
> > it will be much easier if you are needing to remove the same
> > color
> > region from each image. one problem with doing things as you
> > mentioned
> > so far is that it might be very difficult to know where to pick
> > the
> > color from.
> No problem.
> I do not want to automatizr that.
> Clicking in the "right" place (white area inside a balloon) is OK.
use gimp-perl or gimp-python or C then. they all have gtk wrapped
widget sets. gimp (to the best of my understanding) cannot be scripted
to run that way without some help from widget sets.
> > > Please remember that my graphics ability is zilch :(
> > >
> > another thing to consider is gimp gap.
> Sorry, I do not understand :(
gimp gap is the animation plug-in. it will do the same sort of
operation on stacks of images. i dunno if it would be helpful to do
everything you need to do. for instance, if you open each image in gimp
and get your selection and save the image as an xcf with the selection
active -- you can then tell gap to fill the selection on all the images
and tell gap to invert the selection on all of the images and then tell
gap one more time to fill the selection on all the images.
text would still have to be handled separately or individually. saving
the boundries of the selection before inverting would be very helpful at
> > > P.S.: Please copy directly me; I tried to subscribe to the
> > list, but I'm unsure it worked (I didn't receive any message,
> > yet).
> > >
> > it is a tradition of this maillist.
> No longer a problem.
> I *am* on the list :)
now, what is weird is that your email is not handling threading. i do
not know how to fix it, i guess all i know how to do is to whine about
also, since the email i read had the gimp-user signature stripped from
it, i think you are sending with html mail. please do not do that --
that said, at least your mailer sends the mime type correctly so that
the email can be stripped of this.
many of the people who can help you the most have little patience for
html mail. simple text is so easily read by everyone and every mailer,
it might seem like asking a lot when actually what is being asked is
just a little.
Gimp-user mailing list