Quiet Gimp script to make screenshots

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Quiet Gimp script to make screenshots

Gerhard Kulzer
As manual writers we generate a lot of nice screenshots, a task which can be
quite tedious. To make life a (little) bit easier I updated my Gimp script-fu
to this:

http://digikam3rdparty.free.fr/Tools/kde-screenshot-dropshadow.scm

The script creates a dropshadow conforming to KDE standard. I runs without
dialog and flattens the layers at the end. So the only action it to call it
(from 'Script-Fu'->Utils) and save the screenshot.

This is an update of my previous scripts, which it replaces. It runs fine on
Gimp 2.3.14 and should be backwards compatible at least down to Gimp 2.0
(because the parser of the recent version is stricter)

And, since I'm at it...
The following command compresses the produced PNG file considerably (that's
nice for smaller packages) without visible quality loss:

$ pngnq -s 3 ./*.png && optipng *-nq8.png && rename -f s/-nq8\.png/.png/
*-nq8.png
Just run it in the screenshot directory from a shell.

Of course you need to have optipng and pngnq installed.

Regards
Gerhard

P.S.
Project: shell script using Imagemagick with optipng to do it all at once
without Gimp
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quiet Gimp script to make screenshots

Bugzilla from mikmach@wp.pl
Dnia piątek 16 luty 2007, Gerhard Kulzer napisał:
> Project: shell script using Imagemagick with optipng to do it all at
> once without Gimp

I wrote IM script for that long time ago. Should be in archives of the
list.

OK, found it. Looks like -fx changed between 6.2 and 6.3, after
necessary fixes it is here:
------------------------------------------------------------
#!/bin/bash
#
# Author: (c) Mikolaj Machowski 2005-2007
# License: GPL

# About: script to produce shadows, look correspondents to shadows of
photos in
# manual of digiKam http://www.digikam.org
# Requires: ImageMagick 6.3 http://www.imagemagick.org

name=$1
radius=0
sigma=3.5
stran=0.80
width=`identify -format %w $name`
height=`identify -format %h $name`
bgwidth=$(($width+15))
bgheight=$(($height+15))
swidth=$(($width+7))
sheight=$(($height+7))

convert -size ${bgwidth}x${bgheight}+0+0 xc:none \
        -draw "fill black rectangle 7,7 $swidth,$sheight" \
        -channel RGBA -blur ${radius}x${sigma} \
        -channel A -fx "a*$stran" \
        -draw "fill black line 0,0 0,$(($height+1))" \
        -draw "fill black line 0,0 $(($width+1)),0" \
        -draw "fill black line 0,$(($height+2)), $(($width+2)),$(($height+2))" \
        -draw "fill black line $(($width+2)),0 $(($width+2)),$(($height+2))" \
        -draw "image Over 1,1 $width,$height $name" final-$name

#convert -size ${bgwidth}x${bgheight}+0+0 xc:none \
# -draw "fill black rectangle 7,7 $swidth,$sheight" \
# -channel RGBA -blur ${radius}x${sigma} \
# -channel A -fx "a*$stran" \
# -draw "image Over 0,0 $width,$height $name" final-$name
------------------------------------------------------------
Commented version is for images which don't require 1pixel frame around
them, I use it rarely and not useful for Digikam manual photos.

m.

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quiet Gimp script to make screenshots

Gerhard Kulzer
In reply to this post by Gerhard Kulzer
Am Tuesday 20 February 2007 schrieb Mikolaj Machowski:

> Dnia wtorek 20 luty 2007, Gerhard Kulzer napisa³:
> > Hi Mikolaj,
> > I forgot to give you feedback! Thanks a lot for the script, it's what I
> > was looking for, except that it does't quite work. The following last
> > line doesn't go though:
> > -draw "image Over 1,1 $width,$height $name" final-$name
> >
> > convert: Non-conforming drawing primitive definition `image'.
> >
> > I played bit around with imagemagick, and it does it also if I use the
> > line alone and with expanded names. But according to the manual the
> > syntax is quite correct.
> > Any idea?
>
> Which version of IM do you have? Works for me in IM 6.3. The only
> explanation I have is that something was borked with whitechars. I am
> attaching script now.
>
> m.
I'm still stuck with 6.2.4 (Debian experimental). I guess that's the problem.
Will try to upgrade.

Thanks Mikolaj

--
Hakuna matata
http://www.gerhard.fr

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Quiet Gimp script to make screenshots

Bugzilla from mikmach@wp.pl
Dnia środa 21 luty 2007, Gerhard Kulzer napisał:

> >
> > Which version of IM do you have? Works for me in IM 6.3. The only
> > explanation I have is that something was borked with whitechars. I am
> > attaching script now.
> >
> > m.
>
> I'm still stuck with 6.2.4 (Debian experimental). I guess that's the
> problem. Will try to upgrade.
>

Strange. To make it work with 6.3 I had only slightly change argument
of -fx option. -draw worked as it should.

m.


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quiet Gimp script to make screenshots

Bugzilla from mikmach@wp.pl
In reply to this post by Gerhard Kulzer
Dnia środa 21 luty 2007, Gerhard Kulzer napisał:
> I'm still stuck with 6.2.4 (Debian experimental). I guess that's the
> problem. Will try to upgrade.

Another idea - maybe file name is a problem (space, special character,
etc.)? Try it with asdf.png ;)

m.


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quiet Gimp script to make screenshots

Bugzilla from mikmach@wp.pl
In reply to this post by Gerhard Kulzer
Dnia czwartek 22 luty 2007, Gerhard Kulzer napisał:

> Am Tuesday 20 February 2007 schrieb Mikolaj Machowski:
> > Dnia wtorek 20 luty 2007, Gerhard Kulzer napisa?:
> > > Hi Mikolaj,
> > > I forgot to give you feedback! Thanks a lot for the script, it's
> > > what I was looking for, except that it does't quite work. The
> > > following last line doesn't go though:
> > > -draw "image Over 1,1 $width,$height $name" final-$name
> > >
> > > convert: Non-conforming drawing primitive definition `image'.
> > >
> > > I played bit around with imagemagick, and it does it also if I use
> > > the line alone and with expanded names. But according to the manual
> > > the syntax is quite correct.
> > > Any idea?
> >
> > Which version of IM do you have? Works for me in IM 6.3. The only
> > explanation I have is that something was borked with whitechars. I am
> > attaching script now.
> >
> > m.
>
> I'm still stuck with 6.2.4 (Debian experimental). I guess that's the
> problem. Will try to upgrade.
>
BTW - in 6.3 you can make it in one line:

convert from.png -bordercolor black -border 1x1 \
        \( +clone -background black -shadow 80x3+7+7 \) \
        +swap -background none -mosaic to.png

m.

ps. Courtesy of Anthony Thyssen :)


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quiet Gimp script to make screenshots

Gerhard Kulzer
In reply to this post by Bugzilla from mikmach@wp.pl
A little bug corrected in my gimp script: the last command must be 'merge
layers' and not 'flatten layers'.

The online script is corrected.

Gerhard

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

attachment0 (196 bytes) Download Attachment