Evaluate/Operator in perl API

Didster <[email protected]> Wed, 16 Sep 2015 12:12:22 +0100
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <CAOzufmWbo2G0+wTN-0Uw4yYaT4nW18_nRLfoAoiwcnLCSNdgBg@mail.gmail.com>
--===============0713373935317566108==
Content-Type: multipart/alternative; boundary=94eb2c07c35e61e6e4051fdb5f5e

--94eb2c07c35e61e6e4051fdb5f5e
Content-Type: text/plain; charset=UTF-8

Hi,

I'm looking to switch to GM from IM for a script that I have that processes
around about 60,000 images as IM is god awful slow after the first 1000 or
so, even with MP support complied out.  Each source image is resized to a
number of destination sizes by:

1. Resize the actual image, if the destination is smaller
2. Center the actual image in a white background the size of the destination
3. Overlay a "watermark" which has been made transparent to different
levels using IM

For step 2, I was using IM->Extent() which doesnt seem to exist in GM so
instead I'm now creating a blank white background and Composing the image
over the top, that works fine.

For step 3, I was using something like this:

$wmFileHandle->Evaluate(
 operator => 'Multiply',
 value    => $opacity,
 channel  => 'Alpha',
);

Where $opacity is an float from 0.0 to 1.0.

What would be the equivalent in GM for Perl?  I know using convert its
"-operator" e.g.

gm convert input.png -operator Opacity Multiply 0.5 output.png

I have also tried leaving the watermark as fully opaque and then using

$mainImageHandle->Composite( compose => 'Over', image => $wmFileHandle,
opacity => $opacity );

But that gives corruption [the same problem I was having with IM, which
lead me to switch to Evaluate]

Many thanks

--94eb2c07c35e61e6e4051fdb5f5e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>I&#39;m looking to switch to GM fro=
m IM for a script that I have that processes around about 60,000 images as =
IM is god awful slow after the first 1000 or so, even with MP support compl=
ied out.=C2=A0 Each source image is resized to a number of destination size=
s by:</div><div><br></div><div>1. Resize the actual image, if the destinati=
on is smaller</div><div>2. Center the actual image in a white background th=
e size of the destination</div><div>3. Overlay a &quot;watermark&quot; whic=
h has been made transparent to different levels using IM</div><div><br></di=
v><div>For step 2, I was using IM-&gt;Extent() which doesnt seem to exist i=
n GM so instead I&#39;m now creating a blank white background and Composing=
 the image over the top, that works fine.</div><div><br></div><div>For step=
 3, I was using something like this:</div><div><br></div><div><div>$wmFileH=
andle-&gt;Evaluate(</div><div><span class=3D"" style=3D"white-space:pre">		=
			</span> =C2=A0operator =3D&gt; &#39;Multiply&#39;,</div><div><span class=
=3D"" style=3D"white-space:pre">					</span> =C2=A0value =C2=A0 =C2=A0=3D&g=
t; $opacity,</div><div><span class=3D"" style=3D"white-space:pre">					</sp=
an> =C2=A0channel =C2=A0=3D&gt; &#39;Alpha&#39;,</div><div><span class=3D""=
 style=3D"white-space:pre">					</span>);</div></div><div><br></div><div>Wh=
ere $opacity is an float from 0.0 to 1.0.</div><div><br></div><div>What wou=
ld be the equivalent in GM for Perl?=C2=A0 I know using convert its &quot;-=
operator&quot; e.g.</div><div><br></div><div>gm convert input.png -operator=
 Opacity Multiply 0.5 output.png<br></div><div><br></div><div>I have also t=
ried leaving the watermark as fully opaque and then using=C2=A0</div><div><=
br></div><div>$mainImageHandle-&gt;Composite( compose =3D&gt; &#39;Over&#39=
;, image =3D&gt; $wmFileHandle, opacity =3D&gt; $opacity );</div><div><br><=
/div><div>But that gives corruption [the same problem I was having with IM,=
 which lead me to switch to Evaluate]</div><div><br></div><div>Many thanks<=
/div><div><br></div><div><br></div></div>

--94eb2c07c35e61e6e4051fdb5f5e--


--===============0713373935317566108==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
--===============0713373935317566108==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Graphicsmagick-apis mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-apis

--===============0713373935317566108==--