Forums / Developer / ImageMagick: watermark filter not working

ImageMagick: watermark filter not working

Author Message

olagato olagato

Thursday 17 January 2008 10:22:47 am

Hi,

On one hand I have in "image.tpl" :
{attribute_view_gui attribute=$object.data_map.image image_class=medium}
This displays correctly an image class=medium

On the other hand I have in "settings\siteaccess\esl\image.ini.append.php" :
[medium]
Reference=
Filters[]
Filters[]=-watermark 100% -gravity center /design/ezwebin_site/images/my_logo.png

This filter doesnt work but so others like:
Filters[]=geometry/scaledownonly=300;300
Filters[]=centerimg=100;100
Filters[]=border/color=200;100;10
Filters[]=border=2;2

Any ideas to try the "watermark" filter on the image ?

Maxime Thomas

Monday 21 January 2008 3:06:55 am

Hi,

If you activate the debug, clear the caches and refresh your page, have you got some error in the debug list ?

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

olagato olagato

Tuesday 22 January 2008 9:09:10 am

a ) Watermark image = design/ezwebin_site/images/my_logo.png
b ) Background image = photo-800x600.jpg ( class = medium )

******************** TEST 1: ***************************
At "settings\siteaccess\esl\image.ini.append.php", an alias "marcagua" is defined and then applied to "class=medium" images:

Filters[]=marcagua=-watermark 100% -gravity center /design/ezwebin_site/images/my_logo.png

[medium]
Reference=
Filters[]
Filters[]=marcagua

The debug shows this output (2):

1.1- Warning: eZImageShellHandler::convert
Failed executing: ""C:\WINDOWS\ImageMagick\convertim.exe" "-quality" "100" "-watermark" "100%" "-gravity" "center" "/design/ezwebin_site/images/my_logo.png" "var/ezwebin_site/storage/images/media/images/photo-800x600/997-1-esl-ES/photo-800x600.jpg" "JPEG:var/ezwebin_site/storage/images/media/images/photo-800x600/997-1-esl-ES/photo-800x600_medium.jpg"", Error code: 1

1.2- Error: eZImageManager::createImageAlias
Failed converting var/ezwebin_site/storage/images/media/images/photo-800x600/997-1-esl-ES/photo-800x600.jpg to alias 'original' in directory 'var/ezwebin_site/storage/images/media/images/photo-800x600/997-1-esl-ES'

******************** TEST 2: ***************************
At "settings\siteaccess\esl\image.ini.append.php", watermark filter is directly applied to "class=medium" images:
Filters[]=-watermark 100% -gravity center /design/ezwebin_site/images/my_logo.png

this displays next message:
2.1- Warning: eZImageManager::convert
The filter '-watermark 100% -gravity center /design/ezwebin_site/images/my_logo.png' is not supported by any of the image handlers, will ignore this filter

olagato olagato

Thursday 24 January 2008 5:00:11 am

I have got the "watermark" filter working but not in the way I would like.
Our ImageImagick version didn't support "-watermark" method so I had to use "-composite" instead:

At "settings/image.ini" I wrote this line:
Filters[]=marcagua=-composite -gravity center design/ezwebin_site/images/my_logo.png

At "settings\siteaccess\esl\image.ini.append.php" these lines:
[ImageMagick]
Filters[]=marcagua=-composite -gravity center design/ezwebin_site/images/my_logo.png

[medium]
Reference=
Filters[]
Filters[]=geometry/scaledownonly=300;300
Filters[]=marcagua

However the image displayed is wrong because it shows the "background image" but with the size of "my_logo.png". Maybe the filter's syntax is wrong.
Any idea would be appreciated.

olagato olagato

Tuesday 26 February 2008 9:05:16 am

SOLVED !!!

ImageMagick's "swap" command was the solution:

At "extension\ezwebin\design\ezwebin\override\templates\full\event.tpl" I wrote this:

{attribute_view_gui attribute=$node.data_map.image image_class=medium lightbox_class=large}

"image_class=medium" is the style for the thumbnail image
"lightbox_class=large" is the style for the big image with lightbox (clicked image)

At "settings\siteaccess\esl\image.ini.append.php" I wrote this:

[ImageMagick]
Filters[]=pictoric_watermark=+swap -charcoal 1 -compose Multiply -gravity northeast -resize 60% -composite design/ezwebin_site/images/logo.png

Filters[]=watermark_resize_60=+swap -compose Multiply -gravity northeast -resize 60% -composite design/ezwebin_site/images/logo.png

Filters[]=watermark_resize_100=+swap -compose Multiply -gravity northeast -composite design/ezwebin_site/images/logo.png

[medium]
Reference=
Filters[]
Filters[]=watermark_resize_60

[large]
Reference=
Filters[]
Filters[]=watermark_resize_100

Nicolas BASTIAN

Wednesday 21 May 2008 1:58:29 am

RESOLVED

<?php /* #?ini charset="iso-8859-1"?

[ImageMagick]
Filters[]=watermark=+swap -composite -gravity center /var/www/ez_site/extension/design/ez_site/images/watermark.png

[MIMETypeSettings]
Quality[]
Quality[]=image/jpeg;85

[AliasSettings]
AliasList[]=watermark_thumb

[watermark_thumb]
MIMEType=image/jpeg
Reference=
Filters[]
Filters[]=geometry/scaledownonly=655;485
Filters[]=watermark=

*/ ?>

laurent le cadet

Monday 14 June 2010 9:12:30 am

Hi,

4.3.0
I tried this :

[ImageMagick]
Filters[]=watermark=-compose Multiply -gravity northeast -resize 60% -composite /extension/ezwebin/design/ezwebin/images/watermark.png

[lightbox]
Reference=
Filters[]
Filters[]=geometry/scaleheight=600
Filters[]=watermark=

But can't make it work.

The image is not generate.

I use this with lightbox, but i don't think it's important as we just ask for image alias.

Any help will be appreciated.

Laurent

Guillaume HH

Saturday 19 March 2011 1:23:39 am

HI,

I use this filter

Filters[]=watermark=-gravity SouthEast -pointsize 16 -draw 'fill #cd0202 text 10,10 "© your copyright text here"'

That writes your text on picture in red.

It's quicker an easier to write text on picture than merge two images into one :-)