 |
support.bibblelabs.com Forums for Bibble
|
| View previous topic :: View next topic |
| Author |
Message |
afx Bibble Expert
.gif)
Joined: 21 Jul 2005 Posts: 3981 Location: Munich
|
Posted: Wed Mar 15, 2006 7:28 am Post subject: |
|
|
While I would like to see a generic ImageMagic plugin, I do not think a plugin is the way to go for a watermark. To me this is a property of the output batch queue just like color space or image dimension.
cheers
afx _________________ sRGB clipping sucks |
|
| Back to top |
|
 |
marcof Bibble Expert
.gif)

Joined: 14 May 2003 Posts: 1442 Location: netherlands
|
Posted: Wed Mar 15, 2006 7:34 am Post subject: |
|
|
| afx wrote: | While I would like to see a generic ImageMagic plugin, I do not think a plugin is the way to go for a watermark. To me this is a property of the output batch queue just like color space or image dimension.
cheers
afx |
agreed, but I am not aware of any development schedules (and priorities) at bibblelabs, so maybe starting with a plugin might be the most pragmatic way. Not so much an Imagemagick powered plugin, but a "real" plugin a la BPTlens for instance. _________________ Bibble 5 RAWks! |
|
| Back to top |
|
 |
Dale

Joined: 01 Nov 2004 Posts: 170 Location: Petawawa, On. Canada
|
Posted: Wed Mar 15, 2006 8:13 am Post subject: |
|
|
| marcof wrote: | fwiw I posted a proposal in the SDK developer group.
not sure if anyone will pick it up, I certainly hope so, since eric said it would be "painfully easy" to do  |
I also hope so as I've tried the other methods for windows in this thread with no luck. It would be great to have Bibble plug-in like BPTlens.  _________________ Regards,
DK
___________
20D,5DMKII |
|
| Back to top |
|
 |
Rob Greenstein
Joined: 12 Mar 2006 Posts: 246 Location: Woodland Hills, CA, USA
|
Posted: Mon Mar 20, 2006 8:04 am Post subject: |
|
|
| The extremely high number of views for this thread would suggest that a Watermark capability is of great interest to many Bibble Forums readers. |
|
| Back to top |
|
 |
TonyKInTexas
Joined: 14 Oct 2004 Posts: 271
|
Posted: Mon Mar 20, 2006 4:00 pm Post subject: |
|
|
| I e-mailed asking for the plug-in SDK last week. So far I have had no response to my request. |
|
| Back to top |
|
 |
bibble Site Admin
.gif)
Joined: 30 Mar 2002 Posts: 6834 Location: Austin, Tx
|
Posted: Mon Mar 20, 2006 6:35 pm Post subject: |
|
|
Sorry tony, I only check that email once a week or so. I'll enable your access right now.
Of course, your always welcome to stop by the offices if you'd like too
Eric |
|
| Back to top |
|
 |
cogitech

Joined: 26 Feb 2005 Posts: 173
|
Posted: Thu Mar 23, 2006 5:26 pm Post subject: Re: Wanted to post my watermark script |
|
|
| Khaytsus wrote: | Howdy.. Figured since I was on a kick of updating my watermark script, I'd post it here for other people to use.. ImageMagick is required, and it's a bash script in Linux, so might need adaptation into some other unicies, etc.. But hope it's useful to some.
I have a 800x800 max output "proof" Queue, and I now also have a duplicate of that which is a "Watermarked Proof" queue, which runs this script by checking "run in external viewer" which quietly in the background adds the watermark to the image. Adds a few seconds to each image on my AMD64 3200. Hint: Name this something like watermark.sh since Bibble looks for *.* (possibly being fixed in the near future, however..)
The cool thing is, with some help from the script earlier in this thread and the webpage the example came from, the watermarking is entirely dynamic. The text is created on the fly, so if you want to update the text you just update the script. Downside is that the font isn't fancy and there's no graphics, but that could be pretty easily added. For right now, I just wanted to reduce the possibility of clients printing my proofs I send them.
To test this, I'd suggest copying a few sizes of portrait and landscape images into a test directory and running the script on them like "watermark.sh picture.jpg" and then looking at the picture.jpg to see if the watermark looks okay. This way you can make sure that the programs this script is using are available (all should be from ImageMagick) and things are working as you expect. Once you've tested it, you can try doing it from a Bibble queue.
| Code: |
#!/bin/bash
# Text that's laid out down the middle of the image about every third.
spantext="Unlimited Photo"
# Text in the bottom-right corner of the image
copytext="Copyright Walter Francis\nhttp://unlimitedphoto.com"
# Amount that the text is lightened when composited onto the image.
disolve=35
### Don't think you need to edit below here unless you want to tweak.
# Determine the size of the input image..
sizetmp=`identify $1 | cut -f 3 -d " "`
sizex=`echo $sizetmp | cut -f 1 -d x`
sizey=`echo $sizetmp | cut -f 2 -d x`
# Calculate the size of the fonts based on image size
fontsize=`expr $sizex / 18`
fontsizesm=`expr $sizex / 35`
# Offset that the top and bottom 'span' text is away from the edges
annospan=`expr $sizex / 10`
# Offset that the copyright text is from the edges.
annocopyright=`expr $sizex / 30`
# Create the 'temporary' image for the watermark.
convert -size ${sizex}x${sizey} -pointsize $fontsize -font Helvetica xc:none -fill grey \
-gravity North -annotate 0x0+0+${annospan} "$spantext" \
-gravity Center -annotate 0x0+0+0 "$spantext" \
-gravity South -annotate 0x0+0+${annospan} "$spantext" \
-gravity SouthEast -pointsize $fontsizesm -annotate \
0x0+${annocopyright}+${annocopyright} "$copytext" \
miff:- |\
# Do the watermarking of the image, output to itself so the file written from
# Bibble is the one that is watermarked.
composite -dissolve $disolve - $1 $1
|
|
Thanks! That's awesome! Got it working! I love it. |
|
| Back to top |
|
 |
afx Bibble Expert
.gif)
Joined: 21 Jul 2005 Posts: 3981 Location: Munich
|
Posted: Thu Apr 13, 2006 11:09 am Post subject: |
|
|
Ok,
got it finally working on windows as well. It was much easier on Linux
For windows, cygwin does not work too well. I had problems with Perl, arguments would not be passed.
Instead I installed ActivePerl, manually installed Image::IPTCInfo and to get the Fonts I installed GhostScript and then I needed ImageMagick, but no computer should be without it anyway.
I use a DOS batch file to call the Perl Script:
| Code: | @echo off
c:\perl\bin\perl -w c:\bin\watermark.pl %1 %2 %3 |
I adjusted the Perl script from Andreas a bit. I prefer embossed watermarks, they are less obtrusive. I also changed the logic a bit to avoid emtpy strings which might be an artifact from IPTC parsing.
| Code: |
# Author: Andreas Schrell: as [at] schrell.de
# slightly tweaked by afx at muc.de
# Description: create watermarks in picture with optional reading of IPTC info
# Info: put configuration in watermark.conf and locate it in home directory
# Version: 1.1 Mo. 13.03.2006 19:10:38
# Required: perl and Image::IPTCInfo
# IPTC ATTRIBUTE REFERENCE
# object name originating program
# edit status program version
# editorial update object cycle
# urgency by-line
# subject reference by-line title
# category city
# fixture identifier sub-location
# content location code province/state
# content location name country/primary location code
# release date country/primary location name
# release time original transmission reference
# expiration date headline
# expiration time credit
# special instructions source
# action advised copyright notice
# reference service contact
# reference date caption/abstract
# reference number writer/editor
# date created image type
# time created image orientation
# digital creation date language identifier
# digital creation time
#
# custom1 - custom20: NOT STANDARD but used by Fotostation.
# IPTCInfo also supports these fields.
use Image::IPTCInfo;
my $home;
if (defined $ENV{HOMEPATH}) { $home=$ENV{HOMEPATH}; }
if (defined $ENV{HOME}) { $home=$ENV{HOME}; }
my $settings = "c:\\$home\\watermark.conf";
our $filename = $ARGV[0];
our ($Center,@Center,$North,@North,$East,@East,$West,@West,$South,@South);
our ($NorthWest,@NorthWest,$NorthEast,@NorthEast,$SouthWest,@SouthWest,$SouthEast,@SouthEast);
our $text;
our $font;
our $fontsize;
our $textcolor;
our $undercolor;
our $off;
our $offx;
our $offy;
our $dissolve;
our $view;
### Don't think you need to edit below here unless you want to tweak.
# Determine the size of the input image..
my $sizetmp=qx/identify $filename/;
if ($sizetmp =~ /^[^ ]+ [^ ]+ ([0-9]+)x([0-9]+) /) {
$sizex = $1;
$sizey = $2;
} else {
$sizex = 1000;
$sizey = 750;
}
$off='xy';
$Center->{off} = '';
$North->{off} = 'y';
$South->{off} = 'y';
$West->{off} = 'x';
$East->{off} = 'x';
my $cmd = "convert -size ${sizex}x${sizey} xc:none ";
require "$settings";
my $zero=0;
sub setval($$$) {
$pos = $_[0];
$tag = $_[1];
$def = $_[2];
my $w;
eval "\$w = (defined \$$pos" . "->{$tag}) ? \$$pos" . "->{$tag} : ((defined \$$tag) ? \$$tag : '$def')";
return $w;
}
my $info = new Image::IPTCInfo("$filename");
foreach $pos ("Center","North","East","West","South","NorthEast","NorthWest","SouthEast","SouthWest") {
$o = setval($pos,"off","xy");
$ax = setval($pos, (($o=~/x/) ? "offx" : "zero") ,0); $ax = int($ax);
$ay = setval($pos, (($o=~/y/) ? "offy" : "zero") ,0); $ay = int($ay);
$tx = setval($pos,"text","");
$f = setval($pos,"font","Roman");
$fs = setval($pos,"fontsize",$sizey/50); $fs = int($fs);
# $uc = setval($pos,"undercolor",$undercolor);
$tc = setval($pos,"textcolor",$textcolor);
if ($tx) {
while ($tx =~ /\#IPTC\[([^\]]+)\]/) {
if (defined $info) {
my $val = $info->Attribute("$1");
$val = (defined $val) ? $val : "";
$tx =~ s/\#IPTC\[[^\]]+\]/$val/;
}
}
if ( $tx && $tx ne '\n' ) {
$cmd .= "-pointsize $fs ";
$cmd .= "-font $f ";
# $cmd .= "-undercolor $uc ";
$cmd .= "-fill $tc ";
$cmd .= "-gravity $pos -annotate 0x0+$ax+$ay \"$tx\" ";
}
}
}
$cmd .= " -emboss 8 miff:-";
# print "$cmd\n";
system ("$cmd | composite -dissolve $dissolve - $filename $filename");
system ("$cmd > c:/hugo.text");
# Quickview for testing under Linux
if (defined $view) {
system("$view");
}
exit 0; |
Here is the matching config file
| Code: | # control file for watermark.pl Script
# text
$Center->{text} = '';
# $North->{text} = '#IPTC[by-line title]';
# $South->{text} = '#IPTC[caption/abstract]';
$North->{text} = '';
$South->{text} = '';
$East->{text} = '';
$West->{text} = '';
$NorthWest->{text} = '';
$SouthWest->{text} = '© Andreas F.X. Siegert';
$NorthEast->{text} = '© Andreas F.X. Siegert';
$SouthEast->{text} = '';
# offset defaults
$offx = $sizex / 15;
$offy = $sizey / 10;
# special offsets
$SouthEast->{offx} = $sizex / 50;
$SouthEast->{offy} = $sizey / 50;
# fonts
$font = "AvantGarde-Book";
# $font = "Helvetica";
# font size
$fontsize = $sizey / 25;
# $SouthEast->{fontsize} = $sizey / 62;
# Colors
$undercolor = "black";
$textcolor = "gray";
# Dissolve (only global value)
$dissolve = 18;
# Viewer
# $view = "display -resize 1000x1000 $filename";
return 1;
|
Next I'll convert that to an iMatch basic script (where next probably means a looooong time)
cheers
afx _________________ sRGB clipping sucks |
|
| Back to top |
|
 |
claudermilk
Joined: 04 Nov 2005 Posts: 871
|
Posted: Fri Apr 14, 2006 6:43 am Post subject: |
|
|
| afx wrote: |
...
Next I'll convert that to an iMatch basic script (where next probably means a looooong time)
cheers
afx |
Now there's the comment I've been waiting to see!  |
|
| Back to top |
|
 |
pekkal
Joined: 05 Mar 2006 Posts: 22
|
Posted: Fri Apr 14, 2006 12:12 pm Post subject: Good stuff |
|
|
This is really good stuff, and at least on Linux easy enough to set up. The only thing I could ask for is a list of possible choices for colors & fonts, or a pointer to whre these have been documented.  _________________ Pekka L |
|
| Back to top |
|
 |
afx Bibble Expert
.gif)
Joined: 21 Jul 2005 Posts: 3981 Location: Munich
|
Posted: Fri Apr 14, 2006 12:23 pm Post subject: |
|
|
Check out the ImageMagick docs...
It is a very versatile toolkit.
I meanwhile added a bit of USM to my version as I run the script on reduced size images:
-unsharp 3x1+0.7
on the composite commandline.
cheers
afx _________________ sRGB clipping sucks |
|
| Back to top |
|
 |
pekkal
Joined: 05 Mar 2006 Posts: 22
|
Posted: Sun Apr 23, 2006 10:04 am Post subject: Watermark not working after upgrade to 4.7a |
|
|
I just noticed that my batch no longer adds the watermark. The only change I can think of is from Bibble Pro 4.7 to 4.7a.
Does anybody else have the same issue, or any thougths what could be wrong?
25.4: reinstalling the 'watermark' file solved the problem.  _________________ Pekka L
Last edited by pekkal on Tue Apr 25, 2006 10:01 am; edited 1 time in total |
|
| Back to top |
|
 |
TonyKInTexas
Joined: 14 Oct 2004 Posts: 271
|
Posted: Mon Apr 24, 2006 5:58 pm Post subject: |
|
|
An issue I see is one of fonts used for the watermark. Not everyone will want Times or Arial type fonts.  |
|
| Back to top |
|
 |
cogitech

Joined: 26 Feb 2005 Posts: 173
|
Posted: Thu Apr 27, 2006 5:33 pm Post subject: |
|
|
| afx wrote: | Check out the ImageMagick docs...
It is a very versatile toolkit.
I meanwhile added a bit of USM to my version as I run the script on reduced size images:
-unsharp 3x1+0.7
on the composite commandline.
cheers
afx |
Sweeet! I gotta try this! |
|
| Back to top |
|
 |
cogitech

Joined: 26 Feb 2005 Posts: 173
|
Posted: Thu Apr 27, 2006 5:43 pm Post subject: |
|
|
| cogitech wrote: | | afx wrote: | Check out the ImageMagick docs...
It is a very versatile toolkit.
I meanwhile added a bit of USM to my version as I run the script on reduced size images:
-unsharp 3x1+0.7
on the composite commandline.
cheers
afx |
Sweeet! I gotta try this! |
Now *that*, my friends, just made my week!
Perfect!
Thanks, afx!!!
Now if only I could get this script to run on my web galleries... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|