Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Can "The GIMP" freeware be scripted on Linux to do simple operations?

48 views
Skip to first unread message

Danny D.

unread,
Mar 28, 2013, 12:41:59 PM3/28/13
to
On Thu, 28 Mar 2013 15:27:06 +0000 Dave wrote:

> Might take a look at GimpScripter too.It generates Python code for plugins.
> http://registry.gimp.org/node/25305

This is what I will try first, although the comments on that web
page (and others) say GimpScripter is clearly NOT a macro recorder.
http://registry.gimp.org/node/25305
http://gimp.linux.pl/index.php/server/registry/query/L25vZGUvMjUzMDU%3D

They say GimpScripter is a plugin authoring tool (whatever that means).
http://www.gimpusers.com/forums/gimp-developer/13530-announcing-gimpscripter-plugin-authoring-tool-beta-prototype

That having been said, those web pages don't seem to 'contain' any
GimpScripter code though. So, googling, I found this source:
https://github.com/bootchk/gimpscripter

But, of that source, I could only download the main plugin python script.
I could not (yet) find a download for the directory named "gimpscripter".

$ wget https://raw.github.com/bootchk/gimpscripter/master/plugin-gimpscripter.py
$ cp -r gimpscripter ~/.gimp-2.6/plug-ins
$ cp plugin-gimpscripter.py ~/.gimp-2.6/plug-ins
$ chmod +x ~/.gimp-2.6/plug-ins/plugin-gimpscripter.py

So, at the moment, I'm looking for HOW we're supposed to download the
directory named "gimpscripter" at that location.

Danny D.

unread,
Mar 28, 2013, 12:45:24 PM3/28/13
to
On Thu, 28 Mar 2013 16:41:59 +0000 Danny D. wrote:

> So, at the moment, I'm looking for HOW we're supposed to download the
> directory named "gimpscripter" at that location.

According to this web page:
http://www.gimpchat.com/viewtopic.php?f=9&t=4210

The "gimpscripter" repository is 'supposed' to be here:
https://github.com/bootchk/gimpscripter/archives/master

But, it's not there.

Danny D.

unread,
Mar 28, 2013, 12:49:08 PM3/28/13
to
On Thu, 28 Mar 2013 16:41:59 +0000 Danny D. wrote:

> $ wget https://raw.github.com/bootchk/gimpscripter/master/plugin-gimpscripter.py
> $ cp -r gimpscripter ~/.gimp-2.6/plug-ins
> $ cp plugin-gimpscripter.py ~/.gimp-2.6/plug-ins
> $ chmod +x ~/.gimp-2.6/plug-ins/plugin-gimpscripter.py
>
> So, at the moment, I'm looking for HOW we're supposed to download the
> directory named "gimpscripter" at that location.

This failed to download the gimpscripter directory (due to robot restrictions):
$ wget -r --no-parent https://github.com/bootchk/gimpscripter/tree/master/gimpscripter

Danny D.

unread,
Mar 28, 2013, 1:06:22 PM3/28/13
to
On Thu, 28 Mar 2013 16:49:08 +0000 Danny D. wrote:

> This failed to download the gimpscripter directory (due to robot restrictions):
> $ wget -r --no-parent https://github.com/bootchk/gimpscripter/tree/master/gimpscripter

Well, it's a dumb way to do anything, but I used this manual sequence to
download the gimpscripter directory, which others can use (or improve):

$ wget https://raw.github.com/bootchk/gimpscripter/master/plugin-gimpscripter.py
$ cp plugin-gimpscripter.py ~/.gimp-2.6/plug-ins
$ chmod +x ~/.gimp-2.6/plug-ins/plugin-gimpscripter.py
...
$ mkdir -p gimpscripter/{gui,mockmenu}
$ cd ./gimpscripter/gui
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/gui/__init__.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/gui/gimpscripter.glade
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/gui/main_gui.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/gui/param_dialog.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/gui/param_widgets.py
...
$ cd ../mockmenu
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/mockmenu/db_treemodel.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/mockmenu/__init__.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/mockmenu/map_procedures.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/mockmenu/path_treemodel.py
$ wget https://github.com/bootchk/gimpscripter/tree/master/gimpscripter/mockmenu/plugindb.py
...
$ cd ..
$ cp -r gimpscripter ~/.gimp-2.6/plug-ins

At this point, I 'think' I have gimpscripter installed.
Now it's time to figure out how to use it.

Danny D.

unread,
Mar 28, 2013, 1:11:12 PM3/28/13
to
On Thu, 28 Mar 2013 17:06:22 +0000 Danny D. wrote:

> At this point, I 'think' I have gimpscripter installed.
> Now it's time to figure out how to use it.

Actually, that method (using wget) failed somehow.
Here's what happened when I ran GIMP:

$ gimp picture1.jpg
[GIMP]Filters->Gimpscripter


Starting Gimpscripter
Starting Gimpscripter
Traceback (most recent call last):
File "/usr/lib64/gimp/2.0/python/gimpfu.py", line 801, in _run
res = apply(func, params[1:])
File "/home/user1/.gimp-2.6/plug-ins/plugin-gimpscripter.py", line 75, in plugin_main
from gimpscripter.gui import main_gui
File "/home/user1/.gimp-2.6/plug-ins/gimpscripter/__init__.py", line 4
<!DOCTYPE html>
^
SyntaxError: invalid syntax

Danny D.

unread,
Mar 28, 2013, 2:01:51 PM3/28/13
to
On Thu, 28 Mar 2013 17:11:12 +0000 Danny D. wrote:

> Actually, that method (using wget) failed somehow.

Unless we can find a download for gimpscripter, I'll move
on to the second suggested method, i.e., scripts.

I tried the tutorial script, and it worked fine.
http://www.gimp.org/tutorials/Basic_Batch/

So, now I'm trying to edit THAT script to perform the task:
GIMP: Filters->Map->Make Seamless

Clearly, the line that needs to be edited in the script is:
(plug-in-unsharp-mask RUN-NONINTERACTIVE
image drawable radius amount threshold)

I have to change "pllug-in-unsharp-mask" to "Make Seamless".
But what is the name of the "make seamless" plugin?

Highlighting "Filters->Map->Make Seamless" in GIMP, and
then pressing the "F1" key, brings up this web page:
http://docs.gimp.org/2.6/en/plug-in-make-seamless.html

But, that web page does NOT say what the make-seamless tiling
function is named. Googling about, I find this web page:
http://docs.gimp.org/2.6/en/gimp-scripting.html

Which implies I can find the name of the command at the
Xtns/Plugins Details
page. But what is "Xtns" (extensions?).

There is no GIMP menu named "extensions" or "Xtns", so, the
best I can find are these two browsers:
GIMP:Help->Plug-In Browser (271 plug-ins)
GIMP:Help->Procedure Browser (1,060 procedures)

I have no clue whether GIMP:Filters->Map->Make Seamless is
a "procedure" or a "plug-in", so, I'll look at both types.

There must be a better way than sequential searches, but,
using that manual method, one by one, I finally found in
both the "Plug-In Browser" and in the "Procedure Browser",
the "Tile" procedure or plugin named "plug-in-tile".
http://www1.picturepush.com/photo/a/12530254/img/12530254.png

So, I will try to see if I can get "plug-in-tile" to work
via a GIMP batch operation.

Danny D.

unread,
Mar 28, 2013, 2:15:11 PM3/28/13
to
On Thu, 28 Mar 2013 18:01:51 +0000 Danny D. wrote:

> So, I will try to see if I can get "plug-in-tile" to work
> via a GIMP batch operation.

Starting with the working tutorial, I will try to get it to
work for GIMP:Filters->Map->Make Seamless, which, I think is
the "plug-in-tile" procedure or plug-in.

So, let's change this line from:
(plug-in-unsharp-mask RUN-NONINTERACTIVE
image drawable radius amount threshold)
To:
(plug-in-tile RUN-NONINTERACTIVE
image drawable radius amount threshold)

In this simple-unsharp-mask.scm tutorial script, which is run by:
$ gimp -i -b '(simple-unsharp-mask "foo.png" 5.0 0.5 0)' -b '(gimp-quit 0)'
REPORTED: batch command executed successfully

With this ~/.gimp-2.6/scripts/simple-unsharp-mask.scm
(define (simple-unsharp-mask filename radius amount threshold)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-unsharp-mask RUN-NONINTERACTIVE image drawable radius amount threshold)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

We can create this simple-tile.scm test script, run by:
$ gimp -i -b '(simple-tile "foo.png" 5.0 0.5 0)' -b '(gimp-quit 0)'
REPORTED: batch command executed successfully

With this ~/.gimp-2.6/scripts/simple-tile.scm
(define (simple-tile filename radius amount threshold)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-tile RUN-NONINTERACTIVE image drawable radius amount threshold)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

Bummer. Nothing gave an error - but nothing happened either.
Time to debug ...

WIP: What I need to figure out is HOW to tell what command to call
based only on the menu name.

Danny D.

unread,
Mar 28, 2013, 2:39:07 PM3/28/13
to
On Thu, 28 Mar 2013 18:15:11 +0000 Danny D. wrote:

> WIP: What I need to figure out is HOW to tell what command to call
> based only on the menu name.

Trying another approach to find the menu name, I started GIMP
and went to GIMP:Help->Procedure Browser and typed in "seamless".

This found the procedure "plug-in-make-seamless" as shown below:
http://www1.picturepush.com/photo/a/12530364/img/12530364.png

So, I'll try that procedure (which doesn't take any arguments).

1. I created ~/.gimp-2.6/scripts/simple-seamless.scm
(define (simple-seamless filename)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-make-seamless RUN-NONINTERACTIVE
image drawable)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

2. Which I then ran in batch mode with the command:
$ gimp -i -b '(simple-seamless "foo.png")' -b '(gimp-quit 0)'
REPORTED: batch command executed successfully

3. Woo hoo! It worked. The foo.png was now changed to a seamless tile.

Now it's time to work on the next operation!

Danny D.

unread,
Mar 28, 2013, 3:09:11 PM3/28/13
to
On Thu, 28 Mar 2013 18:39:07 +0000 Danny D. wrote:

> Now it's time to work on the next operation!

The next operation is to replicate this command:
[GIMP]:Filters->Map->Illusion (Divisions=8, Mode=1)

1. We find the desired procedure name to be "plug-in-illusion"
[GIMP]:Help->Plug-In Browser->illusion
http://www2.picturepush.com/photo/a/12530570/img/12530570.png

2. We create a script using the original tutorial template:
$ cd ~/.gimp-2.6/scripts
$ cp unsharp.scm simple-illusion.scm
$ vi !$
(define (simple-illusion filename division type)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-illusion RUN-NONINTERACTIVE image drawable division type)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

3. We run GIMP, adding desired values for the Divisions & Mode arguments:
$ gimp -i -b '(simple-illusion "foo.png" 8 1)' -b '(gimp-quit 0)'

Woo hoo! That worked.

Now I can begin scripting the operations to create multiple files:
$ cp original.png foo.png
$ gimp -i -b '(simple-seamless "foo.png")' -b '(gimp-quit 0)'
$ cp foo.png foo_1.png; cp original.png foo.png
$ gimp -i -b '(simple-illusion "foo.png" 8 1)' -b '(gimp-quit 0)'
$ cp foo.png foo_2.png; cp original.png foo.png

Now it's time to work on the next procedure.

Danny D.

unread,
Mar 28, 2013, 3:43:07 PM3/28/13
to
On Thu, 28 Mar 2013 19:09:11 +0000 Danny D. wrote:

> $ cp original.png foo.png
> $ gimp -i -b '(simple-seamless "foo.png")' -b '(gimp-quit 0)'
> $ cp foo.png foo_1.png; cp original.png foo.png
> $ gimp -i -b '(simple-illusion "foo.png" 8 1)' -b '(gimp-quit 0)'
> $ cp foo.png foo_2.png; cp original.png foo.png
> Now it's time to work on the next procedure.

The next operation is to replicate this command:
[GIMP]:Filters->Decor->Old Photo
[x]Defocus, Border size=20, [x]Sepia, [ ]Mottle, [ ]Work on copy

1. We find the desired procedure name to be "script-fu-old-photo"
[GIMP]:Help->Plug-In Browser->old photo
http://www2.picturepush.com/photo/a/12530755/img/12530755.png

2. That help tells us the 8 arguments to "script-fu-old-photo" are:
a. Interactive, non-interactive
b. The image
c. The layer
d. Defocus (toggle)
e. Border size (which we will set to 20.0)
f. Sepia (toggle)
g. Mottle (toggle)
h. Work on copy (toggle)

2. We create a script using the original tutorial template:
$ cd ~/.gimp-2.6/scripts
$ cp unsharp.scm simple-oldphoto.scm
$ vi !$
(define (simple-oldphoto filename defocus border sepia mottle workoncopy)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-old-photo RUN-NONINTERACTIVE
image drawable defocus border sepia mottle workoncopy)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

3. We run GIMP, with values for defocus, border, sepia, mottle, & workoncopy:
Note: I'm assuming that the toggle takes true (t) or nil (n) arguments.

$ gimp -i -b '(simple-oldphoto "foo.png" t 20.0 t n n)' -b '(gimp-quit 0)'
REPORTED: batch command experienced an execution error
Note: I don't know HOW to get a better log file for the error (do you?).

4. Trying "0" for "nil" and "1" for "true":
$ gimp -i -b '(simple-oldphoto "foo.png" 1 20.0 1 0 0)' -b '(gimp-quit 0)'
REPORTS:
GIMP-Error: Calling error for procedure 'gimp-file-save':
Procedure 'gimp-file-save' has been called with an invalid ID for argument 'drawable'.
Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
batch command experienced an execution error

5. NOTE: Hmmm... I remember something about that in the tutorial ...
http://www.gimp.org/tutorials/Basic_Batch/
Which warns:
[quote]
Some plugins or Script-Fu scripts create new layers and then flatten the image again.
This changes the drawable ID. If this is the case insert the following line to get
the current drawable ID just before saving the image
(set! drawable (car (gimp-image-get-active-layer image)))
[/quote]

6. So, let's see where we can add that line in the simple-oldphoto.scm script:
(define (simple-oldphoto filename defocus border sepia mottle workoncopy)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-old-photo RUN-NONINTERACTIVE
image drawable defocus border sepia mottle workoncopy)
(set! drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

7. Hmmm... there was no error - but we didn't get the old photo either:
$ gimp -i -b '(simple-oldphoto "foo.png" 1 20.0 1 0 0)' -b '(gimp-quit 0)'
REPORTS: batch command executed successfully

Comparing the original photo with the results, showed "something" happened,
but not what we had wanted to happen.

Need to debug ... WIP

NOTE: I wish there were better debugging procedures available or known!

Whiskers

unread,
Mar 28, 2013, 9:10:24 PM3/28/13
to
On 2013-03-28, Danny D. <da...@pleasedontemail.com> wrote:
> On Thu, 28 Mar 2013 15:27:06 +0000 Dave wrote:
>
>> Might take a look at GimpScripter too.It generates Python code for plugins.
>> http://registry.gimp.org/node/25305
>
> This is what I will try first, although the comments on that web
> page (and others) say GimpScripter is clearly NOT a macro recorder.
> http://registry.gimp.org/node/25305
> http://gimp.linux.pl/index.php/server/registry/query/L25vZGUvMjUzMDU%3D

[...]

I suggest taking at look at the command-line tools "imagemagick" and
"graphicsmagick".


--
-- ^^^^^^^^^^
-- Whiskers
-- ~~~~~~~~~~

Danny D.

unread,
Mar 29, 2013, 12:55:48 AM3/29/13
to
On Fri, 29 Mar 2013 01:10:24 +0000 Whiskers wrote:

> I suggest taking at look at the command-line tools "imagemagick" and
> "graphicsmagick".

They're powerful tools, I will grant that.
But do they have filters?

For example, do they have a filter that makes old photos?
Do they have a filter that makes pencil drawings?
Do they have a filter that will change the lighting direction?
etc.

I know GIMP has them. So that's why I'm scripting GIMP.

Cousin Stanley

unread,
Mar 29, 2013, 11:39:38 AM3/29/13
to
Danny D. wrote:

> On Fri, 29 Mar 2013 01:10:24 +0000 Whiskers wrote:
>
>> I suggest taking at look at the command-line tools
>> "imagemagick" and "graphicsmagick".

> They're powerful tools, I will grant that.
>
> But do they have filters ?
> ....


http://www.imagemagick.org/Usage/

http://www.imagemagick.org/Usage/filter/


--
Stanley C. Kitching
Human Being
Phoenix, Arizona

unruh

unread,
Mar 29, 2013, 1:07:59 PM3/29/13
to
On 2013-03-29, Cousin Stanley <cousin...@gmail.com> wrote:
> Danny D. wrote:
>
>> On Fri, 29 Mar 2013 01:10:24 +0000 Whiskers wrote:
>>
>>> I suggest taking at look at the command-line tools
>>> "imagemagick" and "graphicsmagick".
>
>> They're powerful tools, I will grant that.
>>
>> But do they have filters ?

Or look at "convert", which is part of the magick toolkit.

Exactly what you mean by "filters" is no longer clear since you removed
the relevant material but it certainly does allow you to alter the
contents of the pictures as well as converting from encoding to another.

Whiskers

unread,
Mar 29, 2013, 1:09:15 PM3/29/13
to

Danny D.

unread,
Mar 29, 2013, 10:21:55 PM3/29/13
to
On Fri, 29 Mar 2013 17:09:15 +0000 Whiskers wrote:

> See <http://www.imagemagick.org/Usage/> and

That's an interestingly organized set of functions.

Reviewing the table, I saw the Photo Handling section,
which does have some of the desired 'fiters', e.g.,
"double exposures", "pencil sketch", and "adding texture
to an image".
http://www.imagemagick.org/Usage/photos/

In addition, there was an "Advanced Techniques" section,
which covered "Complex manipulations of images", containing
Jigsaw pieces, gel effects, and radial flares:
http://www.imagemagick.org/Usage/advanced/

Since the overall goal is to take a portrait photo, and
to enhance it artistically, by automated means, such that
out of the plethora of automated results, one or three
can be chosen, by virtue of the artistry of the batched
results ... I must conclude that we 'can' add Imagemagick
to our repertoire (currently consisting of The GIMP).

thanks.

Danny D.

unread,
Mar 30, 2013, 10:41:33 AM3/30/13
to
On Fri, 29 Mar 2013 17:09:15 +0000 Whiskers wrote:

> See <http://www.imagemagick.org/Usage/> and

Wow. The more I check out these sequences you suggested, the more
I realize scripting The GIMP is the WRONG way to go!

At least it's the wrong way when these Imagemagick command-line
filters readily exist (which can be scripted trivially)!

For example, this makes a GREAT pencil drawing, in seconds!
$ convert foo.jpg -edge 1 -negate -normalize \
-colorspace Gray -blur 0x.5 -contrast-stretch 0x50% \
pencil_drawing.gif

This also worked wonderfully to create a 'sketch'
$ convert foo.jpg -colorspace gray -sketch 0x20+120 \
pencil_sketch.gif

This added tons of contrast, for an interesting effect:
$ convert foo.jpg -sigmoidal-contrast 15x30% high_contrast.jpg

You can even auto-CREATE background images, like these speckles:
$ convert -size 100x100 xc: +noise Random -channel R -threshold 1% \
-negate -channel RG -separate +channel \
\( xc: +noise Random \) -compose multiply -flatten \
-virtual-pixel tile -blur 0x.4 -contrast-stretch .8% \
stars_colored.gif

Wow. Just wow. There's so much there that can be scripted!

Whiskers

unread,
Mar 30, 2013, 11:17:35 AM3/30/13
to
On 2013-03-30, Danny D. <da...@pleasedontemail.com> wrote:
> On Fri, 29 Mar 2013 17:09:15 +0000 Whiskers wrote:
>
>> See <http://www.imagemagick.org/Usage/> and

[...]

> Wow. Just wow. There's so much there that can be scripted!

Even for image processing, the command line has its place :))

-= F =-

unread,
Mar 31, 2013, 4:15:50 AM3/31/13
to
Danny D. wrote:

> On Fri, 29 Mar 2013 17:09:15 +0000 Whiskers wrote:
>
>> See <http://www.imagemagick.org/Usage/> and
>
> Wow. The more I check out these sequences you suggested, the more
> I realize scripting The GIMP is the WRONG way to go!
>
> At least it's the wrong way when these Imagemagick command-line
> filters readily exist (which can be scripted trivially)!

http://www.fmwconcepts.com/imagemagick/index.php


--
---
-= F =-
---
If linux and Windows were women, Windows would be a whore and linux would be
a lady that requires that you develop a relationship first.


(disclaimer: I am not now nor I have ever been affiliated with fmwconcepts.
I have no concepts. Well, maybe once, quite some time ago but I didn't
really grasp the idea of it, so I let it go. C'est La Vie!!)

Danny D.

unread,
Mar 31, 2013, 10:22:25 AM3/31/13
to
On Sat, 30 Mar 2013 15:17:35 +0000 Whiskers wrote:

> Even for image processing, the command line has its place )

I went through the ImageMagick page, and used a few of the
suggested techniques to script it (see below) but now I'll
go back to scripting The GIMP because all I want is to
run a dozen or two dozen filtering operations to automagically
create pleasing versions of images to flip through for selection.

Here's the script using ImageMagick but without The GIMP added ...
#!/bin/sh
idx=expr 0
echo "Enter file name (sans extension)"
read fname
echo "Enter file extension"
read ext
idx=`expr $idx + 1`
echo "Converting ${fname}.${ext} to sketch ${fname}_${idx}.${ext}"
convert ${fname}.${ext} -colorspace gray -sketch 0x20+120 ${fname}_${idx}.
${ext}
feh ${fname}_${idx}.${ext}
idx=`expr $idx + 1`
echo "Converting ${fname}.${ext} to drawing ${fname}_${idx}.${ext}"
convert ${fname}.${ext} -edge 1 -negate -normalize -colorspace Gray -blur
0x.5 -contrast-stretch 0x50% ${fname}_${idx}.${ext}
feh ${fname}_${idx}.${ext}
idx=`expr $idx + 1`
echo "Converting ${fname}.${ext} to contrast ${fname}_${idx}.${ext}"
convert ${fname}.${ext} -sigmoidal-contrast 15x30% ${fname}_${idx}.${ext}
feh ${fname}_${idx}.${ext}
idx=`expr $idx + 1`
echo "Converting ${fname}.${ext} to negative ${fname}_${idx}.${ext}"
convert ${fname}.${ext} \( +clone -fx 'p{0,0}' \) -compose Difference -
composite -modulate 100,0 -alpha off ${fname}_${idx}.${ext}
feh ${fname}_${idx}.${ext}
exit 0

Danny D.

unread,
Mar 31, 2013, 10:42:47 AM3/31/13
to
On Sat, 30 Mar 2013 15:17:35 +0000 Whiskers wrote:

> Even for image processing, the command line has its place )

A unique image-filtering operation I'd love to figure out
(and which others will love also) is how to script this:

$ inkscape foo.jpg
[inkscape]Edit->Select All
[inkscape]Filters->Image effects,transparent->Alpha draw,color
[inkscape]File->Save As->foo.eps->OK

Here is a before and after comparison of the result:
$ convert foo.jpg foo.eps +append comparison.gif
http://www4.picturepush.com/photo/a/12555682/img/12555682.gif
Note: I'm not sure why the eps is slightly smaller than the original.

QUESTION:
Is there an easy way to script this operation on Linux?

Floyd L. Davidson

unread,
Mar 31, 2013, 12:23:20 PM3/31/13
to
If you can tell me what inkscape is actually doing to the image
as a result of the "Filters->Image effects,transparent->Alpha draw,color"
command, I might be able to figure out how to do that with ImageMagick.

--
Floyd L. Davidson http://www.apaflo.com/
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com

Danny D.

unread,
Apr 1, 2013, 1:51:27 AM4/1/13
to
On Sun, 31 Mar 2013 08:23:20 -0800 Floyd L. Davidson wrote:

>> http://www4.picturepush.com/photo/a/12555682/img/12555682.gif
>> Is there an easy way to script this operation on Linux?
>
> If you can tell me what inkscape is actually doing to the image as a
> result of the "Filters->Image effects,transparent->Alpha draw,color"
> command, I might be able to figure out how to do that with ImageMagick.

That's pretty much the ONLY image filtering that Inkscape does that I've
never seen in The GIMP - which is why it's such a nice filtering command.

But, I do NOT know HOW Inkscape does that effect.

Googling, I find this:
http://www.littlewebhut.com/inkscape/graphics_filter_guide/image_effects_transparent/

This covers the "alpha" manipulation - but I don't understand the page:
http://userbase.kde.org/Kdenlive/Manual/Effects/Alpha_manipulation/Alpha_shapes#Operations
http://www.scriptol.com/html5/canvas/transparency.php

Danny D.

unread,
Apr 1, 2013, 1:57:01 AM4/1/13
to
On Sun, 31 Mar 2013 03:15:50 -0500 -= F =- wrote:

> http://www.fmwconcepts.com/imagemagick/index.php

Wow. What a wonderful set of image-filtering scripts!

What I love about that page are the before & after
photos so we can see what it does at a glance!

I will script some of these into my growing bash
shell picture-filtering script & report back!

Thanks for that jewel!

Danny D.

unread,
Apr 1, 2013, 2:08:26 AM4/1/13
to
On Fri, 29 Mar 2013 17:07:59 +0000 unruh wrote:

> Exactly what you mean by "filters" is no longer clear

Good point.

What "I" mean by filter is to globally change a portrait photo
in some esthetic manner in a single fell swoop.

The resulting photo is appreciably different than the original,
but it's always 1:1 recognizable as a global modification of
the original.

For example, here's a before-and-after of an Inkscape operation
that would be nice to script.
http://www5.picturepush.com/photo/a/12561393/img/12561393.png

What I do NOT mean by "filtering" is editing the picture to manually
change anything specific in the picture (e.g., remove blemishes or
remove red eye, or add text, etc.).

Whiskers

unread,
Apr 1, 2013, 11:13:33 AM4/1/13
to
On 2013-04-01, Danny D. <da...@pleasedontemail.com> wrote:
> On Fri, 29 Mar 2013 17:07:59 +0000 unruh wrote:

[...]

> For example, here's a before-and-after of an Inkscape operation
> that would be nice to script.
> http://www5.picturepush.com/photo/a/12561393/img/12561393.png

[...]

Looks like a combination of 'edge detect', 'blur', and 'threshold' effects.

I suggest you use the manual tools to play with the various manipulations
possible - click on an image being shown by the 'display' command to get a
menu of tools. Try right and middle click too ;))

Wolfgang Weisselberg

unread,
Apr 1, 2013, 10:10:06 AM4/1/13
to
Floyd L. Davidson <fl...@apaflo.com> wrote:
> "Danny D." <da...@pleasedontemail.com> wrote:

>>A unique image-filtering operation I'd love to figure out
>>(and which others will love also) is how to script this:

>>$ inkscape foo.jpg
>>[inkscape]Edit->Select All
>>[inkscape]Filters->Image effects,transparent->Alpha draw,color
>>[inkscape]File->Save As->foo.eps->OK

>>Here is a before and after comparison of the result:
>>$ convert foo.jpg foo.eps +append comparison.gif
>> http://www4.picturepush.com/photo/a/12555682/img/12555682.gif
>>Note: I'm not sure why the eps is slightly smaller than the original.

>>QUESTION:
>> Is there an easy way to script this operation on Linux?

> If you can tell me what inkscape is actually doing to the image
> as a result of the "Filters->Image effects,transparent->Alpha draw,color"
> command, I might be able to figure out how to do that with ImageMagick.

Here's the information you wanted:
http://inkscape.org/download/?lang=en

There you can find *all* the details.

-Wolfgang

Danny D.

unread,
Apr 1, 2013, 9:06:35 PM4/1/13
to
On Mon, 01 Apr 2013 16:10:06 +0200 Wolfgang Weisselberg wrote:

> http://inkscape.org/download/?lang=en

Thanks for the link.

I'm reading through the FAQ:
http://wiki.inkscape.org/wiki/index.php/FAQ

And, the forum at that site might be able to help us figure out how to
script the desired image effect.

Here is an example for Image Effects, Transparent, alpha draw current:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Filters-Preset-ImageEffectsTransparent.html
But, it doesn't say how to script it, nor what it does.

0 new messages