<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
It's OK, I've worked it out. There is another set of routines to
retrieve normalised colour values (0..1) and they match up with
dividing the Word values by 65535 so I'm guessing it's to support
graphic formats that have ability to store a 2bytes per pixel colour
depth. Anyway, I'm using the normalised values now and it's all good.<br>
<br>
The ImageMagick libraries seem very good at handling large graphic
files without being processor intensive (although you need a lot of
hard drive space). I'm adapting a TGraphic descendant that someone
wrote a few years ago for an earlier version, to work with the latest
version of ImageMagick (seems they reworked their architecture
somewhat). If anyone else is interested then let me know and I'll make
the code available when it's polished off.<br>
<br>
Phil.<br>
<br>
Paul A Norman wrote:
<blockquote
 cite="mid7a20a4ed0604192349u63e6537bpb7d1be39065c82a7@mail.gmail.com"
 type="cite">Shouldn't, but is there a setting for the Colour Gamut?<br>
  <br>
  <div><span class="gmail_quote">On 21/04/06, <b
 class="gmail_sendername">Todd Martin</b> &lt;<a
 href="mailto:toddm@kol.co.nz">toddm@kol.co.nz</a>&gt; wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Do
you ever get values &gt; 255?<br>
    <br>
Todd.<br>
    <br>
On Wednesday 19 Apr 2006 21:42, Phil Middlemiss wrote:
    <br>
&gt;&nbsp;&nbsp;Thanks for the example Todd - yeah, that's compiling and seems to
be<br>
&gt; running fine. There are no reported memory leaks around the pixel
wands<br>
&gt; either.<br>
&gt;<br>
&gt;&nbsp;&nbsp;One question though: the PixelPacket contains *Word* values for
red,
    <br>
&gt; green, blue, and opacity. How do I interpret values greater than
255?<br>
&gt;<br>
&gt;&nbsp;&nbsp;Cheers,<br>
&gt;&nbsp;&nbsp;Phil.<br>
&gt;<br>
&gt;&nbsp;&nbsp;Todd Martin wrote:<br>
&gt; Hi Phil<br>
&gt;<br>
&gt; I've only just started looking at Image Magic myself.
    <br>
&gt; Try this :)<br>
&gt; You'll need to add a correction and a function declaration to<br>
&gt; "pixel_iterator.inc" as outlined below.<br>
&gt;<br>
&gt; uses<br>
&gt;&nbsp;&nbsp; magick_wand, ImageMagick;<br>
&gt;<br>
&gt; procedure DrawDiagonalLine(AInputFileName, AOutputFileName :
AnsiString);
    <br>
&gt; var<br>
&gt;&nbsp;&nbsp; Iterator : PPixelIterator;<br>
&gt;&nbsp;&nbsp; PixelWands : PPPixelWand;<br>
&gt;&nbsp;&nbsp; ImageWand : PMagickWand;<br>
&gt;&nbsp;&nbsp; Status : MagickBooleanType;<br>
&gt;&nbsp;&nbsp; RowIndex, WandCount : Cardinal;<br>
&gt; begin<br>
&gt;&nbsp;&nbsp; Iterator := nil;
    <br>
&gt;&nbsp;&nbsp; ImageWand := nil;<br>
&gt;&nbsp;&nbsp; try<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; ImageWand := NewMagickWand;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; status := MagickReadImage(ImageWand,PChar(AInputFileName));<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; if (status = MagickTrue) then<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; begin<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //use a pixel iterator to draw a diagonal line
    <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Iterator:=NewPixelIterator(ImageWand);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if assigned(Iterator) then<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //return the next row as an array of pixel wands<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);
    <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RowIndex := 0;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while assigned(PixelWands) do<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inc(PixelWands,RowIndex); //move to the pixel wand at
column=row<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelSetColor(PixelWands^,'#224466');
    <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelSyncIterator(Iterator);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inc(RowIndex);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MagickWriteImage(ImageWand,PChar(AOutputFileName));
    <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; end;<br>
&gt;&nbsp;&nbsp; finally<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; DestroyPixelIterator(Iterator);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; DestroyMagickWand(ImageWand);<br>
&gt;&nbsp;&nbsp; end;<br>
&gt; end;<br>
&gt;<br>
&gt; initialization<br>
&gt;&nbsp;&nbsp; MagickWandGenesis;<br>
&gt;<br>
&gt; finalization<br>
&gt;&nbsp;&nbsp; MagickWandTerminus;<br>
&gt;<br>
&gt;<br>
&gt; ....and put the following in pixel_iterator.inc<br>
&gt;<br>
&gt; //****correction*****<br>
&gt; function NewPixelIterator(wand: PMagickWand): PPixelIterator;
cdecl;
    <br>
&gt; external WandExport;<br>
&gt;<br>
&gt; //****extra declaration****<br>
&gt; function PixelGetNextIteratorRow(iterator: PPixeliterator; var
columnCount<br>
&gt; : Cardinal) : PPPixelWand; cdecl; external WandExport;<br>
&gt;<br>
&gt; I compiled this in Kylix. Let me know if you have any problems.<br>
&gt; Todd.<br>
&gt;<br>
&gt; On Wednesday 19 Apr 2006 03:54, Phil Middlemiss wrote:<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;Yeah, I've got the source and looked through the API.
    <br>
&gt;<br>
&gt;&nbsp;&nbsp;&gt;From what I can see of the API though, it jumps straight down
into the<br>
&gt;&nbsp;&nbsp;&gt; fine details of documenting each method and doesn't have
anything that<br>
&gt;&nbsp;&nbsp;&gt; tells you "This is the general approach to use".
    <br>
&gt;<br>
&gt;&nbsp;&nbsp;For example, I see that there is a routine called
MagickSetFirstIterator<br>
&gt; (among other iteration routines) but nowhere does it describe the
way to<br>
&gt; set up an iteration, or even what you are iterating. There is a
pixel wand
    <br>
&gt; too (and a pixel iterator), but I can't find anything that
describes the<br>
&gt; overall method of using them.<br>
&gt;<br>
&gt;&nbsp;&nbsp;Have you got any examples (I don't care if they are not
documented) that I<br>
&gt; could look at?
    <br>
&gt;<br>
&gt;&nbsp;&nbsp;Cheers,<br>
&gt;&nbsp;&nbsp;Phil.<br>
&gt;<br>
&gt;&nbsp;&nbsp;Todd Martin wrote:<br>
&gt; Hi Phil<br>
&gt;<br>
&gt; Have you looked at the API documents?<br>
&gt;
{myInstallDirectoryForImageMagic}/share/doc/ImageMagick-6.2.6/www/api
    <br>
&gt;<br>
&gt; Are you running Windows or Linux? Do you have the ImageMagic
source or just<br>
&gt; a binary download?<br>
&gt;<br>
&gt; Todd.<br>
&gt;<br>
&gt; On Wednesday 19 Apr 2006 02:39, Phil Middlemiss wrote:<br>
&gt;<br>
&gt;<br>
&gt; Hi all,<br>
&gt;<br>
&gt; I'm trying to understand Image Magick - I have got the Lazerus
headers<br>
&gt; and compiled and run the sample app listed on the wiki page for
it. All<br>
&gt; fine.<br>
&gt;<br>
&gt; Now when it comes to actually working out how to use the thing I'm
not
    <br>
&gt; sure how to go about it. The documentation is a little different
from<br>
&gt; the actual Lazerus files, and even if it were the same it is
lacking the<br>
&gt; whole "This is the overview/paradigm" section.
    <br>
&gt;<br>
&gt; What I really need is a good example that does more than just read
in an<br>
&gt; image and save it to another format. Does anyone has some<br>
&gt; examples/documentation that they are willing to share?<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Phil.<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Delphi mailing list<br>
&gt; <a href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a><br>
&gt; <a href="http://ns3.123.co.nz/mailman/listinfo/delphi">
http://ns3.123.co.nz/mailman/listinfo/delphi</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Delphi mailing list<br>
&gt; <a href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a><br>
&gt; <a href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a><br>
_______________________________________________<br>
Delphi mailing list<br>
    <a href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a><br>
    <a href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a><br>
  </blockquote>
  </div>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Delphi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a>
  </pre>
</blockquote>
</body>
</html>