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.