How to define an imageMagick filter

Author Message

Pascal France

Friday 08 May 2009 12:22:25 am

Hi,

I would like to define this convert commande line as a filter:

convert myimage.jpg \( +clone  -background black  -shadow 120x4+2+2 \) +swap \-background none   -layers merge  +repage   shadow.png

This commande line add a shadow to the image.

I have read this article:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/datatypes/image#comment17917
and this post:
http://ez.no/developer/forum/general/using_imagemagick_to_add_dropshadow_effect_to_images

but I get no result.

For now I set this:

[ImageMagick]
Filters[]=withshadow=( +clone -background black -shadow 120x4+2+2 ) +swap -background none -layers merge  +repage %1

[AliasSettings]
AliasList[]=jaquette

[jaquette]
Filters[]
Filters[]=geometry/scaledownonly=190;190
Filters[]=withshadow=

I have tried this too:

[ImageMagick]
Filters[]=withshadow=\( +clone  -background black  -shadow 120x4+2+2 \) +swap \-background none   -layers merge  +repage %1

Another thing: what does mean 1% ?

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

zenie networks

Friday 08 May 2009 1:18:46 am

hi,

i want know more about this....so,pls tell me more...

_______
zenie
[url=http://www.marketbright.com/products/email-marketing.html]email marketing software[/url]
[url=http://www.pamperedpassions.com]plus size lingerie[/url]

Pascal France

Friday 08 May 2009 2:35:16 am

Hi Zenie,

What do you want to know ?

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

paul bolger

Friday 08 May 2009 3:18:37 am

I'm not sure offhand what's wrong with your filter setup, but this

http://ez.no/developer/forum/setup_design/rounded_corners_on_images/re_rounded_corners_on_images__13

may give you some pointers.

Paul Bolger

Pascal France

Friday 08 May 2009 3:52:17 am

Hi Paul,

Thanks for your answer.

The content of your link is a "copy" of the one I have given in my first post:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/datatypes/image#comment17917

And I can't obtain the result that I expect :-(

I don't understand how to translate the command line that I use to an imageMagick filter.

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Marco Zinn

Friday 08 May 2009 10:35:55 am

Hi Pascal,

I struggled with this some days ago, too. Though my filter was much easier, this may help you:

Working definition in settings/image.ini.append.php:

[ImageMagick]
Filters[]=blueish=-fill #048ffd -colorize 30%

[AliasSettings]
AliasList[]
AliasList[]=small
...

[small]
Reference=
Filters[]
Filters[]=geometry/scaledownonly=200;200
Filters[]=colorspace/gray
Filters[]=colorspace=RGB
Filters[]=blueish

I wanted to make a "blue tinted" version of an image. So, i changed the "small" alias defintion and added two colorspace filters to it, which will first change the colorspace to "gray", making a gray-scale image. As i wanted to give it some color again, the next filter gives the colour an RGB colorspace again.
Finally, i applies my new "blueish" filter, which is declared in the first line.
I had to to some trial and error, too, as the original filter was

-fill "#048ffd" -colorize 30%

That didn't work, so i removed the quotes.

The %1, that you are using is unneeded in your (and my) case. It's used for passing parameters to the filter OTHER than the target filename (this is done by ez).
For reference of the parameters, see the definitions in the original image.ini file and look at the "colorspace" filter (not the "colorspace/gray"), which has 1 parameter or look at "geometry/scaledownonly", which has 2.

In your case, i'm very unsure about the backslashes in your command line... if they are used for escaping the brackets, you may try to omit them in the image.ini.
In any case, you should not use the %1

I would try with this:

[ImageMagick]
Filters[]=withshadow=( +clone -background black -shadow 120x4+2+2 ) +swap -background none -layers merge +repage

[AliasSettings]
AliasList[]=jaquette

[jaquette]
Filters[]
Filters[]=geometry/scaledownonly=190;190
Filters[]=withshadow

or try to define the filter with the backslashes:

[ImageMagick]
Filters[]=withshadow=\( +clone -background black -shadow 120x4+2+2 \) +swap \-background none -layers merge +repage

In any case, try one command after the other! I'm not an IM expert, so this image manipulations seems very complex to me.

Marco
http://www.hyperroad-design.com

Pascal France

Friday 08 May 2009 12:24:06 pm

Hi Marco,

I have solved the problem like that:

[AliasSettings]
AliasList[]=jaquette
AliasList[]=shadowjaquette

[jaquette]
Filters[]
Filters[]=geometry/scaledownonly=190;190

[shadowjaquette]
Filters[]
Filters[]=geometry/scaledownonly=190;190
Filters[]=withshadow=

[ImageMagick]
# C'est le paramètre -blur 8x2 qui définit la longeur de diffusion de l'ombre
# Le paramètre multiply .90 indique le degré de transparence de l'ombre
Filters[]=withshadow=-matte -bordercolor none -border 8  -repage +1+1! -channel A -virtual-pixel transparent -blur 8x1 -evaluate multiply .70 +channel -fill black -colorize 100%

and now in my template:

<div class="jaquette_shadow">
       <img src={$album.data_map.photo_pochette_album.content[shadowjaquette].full_path|ezroot} alt="" />
</div>
<div class="jaquette">
       <img src={$album.data_map.photo_pochette_album.content[jaquette].full_path|ezroot} alt="" />
</div>

First img displays the shadow.
Second img displays the real image.

A litle CSS and that all.

This works fine for me.
Here is an example (each image above the flashplayer):
http://linuxorable.fr/femoca/index.php/femoca/Ecouter/Claude-Nougaro

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:15:06
Script start
Timing: Jan 18 2025 22:15:06
Module start 'layout'
Timing: Jan 18 2025 22:15:06
Module start 'content'
Timing: Jan 18 2025 22:15:07
Module end 'content'
Timing: Jan 18 2025 22:15:07
Script end

Main resources:

Total runtime0.7809 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0093 588.0313152.6406
Module start 'layout' 0.00930.0044 740.671939.4609
Module start 'content' 0.01370.7659 780.1328678.2891
Module end 'content' 0.77960.0013 1,458.421920.1563
Script end 0.7809  1,478.5781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4731160.0002
Check MTime0.00150.1973160.0001
Mysql Total
Database connection0.00280.362710.0028
Mysqli_queries0.696289.1604730.0095
Looping result0.00070.0907710.0000
Template Total0.728093.220.3640
Template load0.00200.259520.0010
Template processing0.725992.962020.3630
Template load and register function0.00010.016910.0001
states
state_id_array0.00170.212010.0017
state_identifier_array0.00110.136820.0005
Override
Cache load0.00190.2436740.0000
Sytem overhead
Fetch class attribute can translate value0.00090.113740.0002
Fetch class attribute name0.00090.118090.0001
XML
Image XML parsing0.00130.166540.0003
class_abstraction
Instantiating content class attribute0.00000.001790.0000
General
dbfile0.00090.1179220.0000
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
23content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
10content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 52
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs