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 :-)

eZ debug

Timing: Jan 18 2025 04:07:59
Script start
Timing: Jan 18 2025 04:07:59
Module start 'content'
Timing: Jan 18 2025 04:08:00
Module end 'content'
Timing: Jan 18 2025 04:08:00
Script end

Main resources:

Total runtime0.9761 sec
Peak memory usage4,096.0000 KB
Database Queries215

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 587.8438180.8125
Module start 'content' 0.00560.8543 768.6563753.8984
Module end 'content' 0.85990.1161 1,522.5547344.4297
Script end 0.9761  1,866.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.3949210.0002
Check MTime0.00150.1493210.0001
Mysql Total
Database connection0.00080.085010.0008
Mysqli_queries0.878389.97752150.0041
Looping result0.00210.21272130.0000
Template Total0.950197.320.4751
Template load0.00190.194620.0009
Template processing0.948297.138820.4741
Template load and register function0.00010.013110.0001
states
state_id_array0.00080.077510.0008
state_identifier_array0.00070.069220.0003
Override
Cache load0.00190.19261120.0000
Sytem overhead
Fetch class attribute can translate value0.00170.173060.0003
Fetch class attribute name0.00120.1225110.0001
XML
Image XML parsing0.00210.217760.0004
class_abstraction
Instantiating content class attribute0.00000.0030140.0000
General
dbfile0.00370.3798390.0001
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
30content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
23content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 72
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs