[DUG] Image Magick examples

Paul A Norman paul.a.norman at gmail.com
Thu Apr 20 18:49:10 NZST 2006


Shouldn't, but is there a setting for the Colour Gamut?

On 21/04/06, Todd Martin <toddm at kol.co.nz> wrote:
>
> Do you ever get values > 255?
>
> Todd.
>
> On Wednesday 19 Apr 2006 21:42, Phil Middlemiss wrote:
> >  Thanks for the example Todd - yeah, that's compiling and seems to be
> > running fine. There are no reported memory leaks around the pixel wands
> > either.
> >
> >  One question though: the PixelPacket contains *Word* values for red,
> > green, blue, and opacity. How do I interpret values greater than 255?
> >
> >  Cheers,
> >  Phil.
> >
> >  Todd Martin wrote:
> > Hi Phil
> >
> > I've only just started looking at Image Magic myself.
> > Try this :)
> > You'll need to add a correction and a function declaration to
> > "pixel_iterator.inc" as outlined below.
> >
> > uses
> >   magick_wand, ImageMagick;
> >
> > procedure DrawDiagonalLine(AInputFileName, AOutputFileName :
> AnsiString);
> > var
> >   Iterator : PPixelIterator;
> >   PixelWands : PPPixelWand;
> >   ImageWand : PMagickWand;
> >   Status : MagickBooleanType;
> >   RowIndex, WandCount : Cardinal;
> > begin
> >   Iterator := nil;
> >   ImageWand := nil;
> >   try
> >     ImageWand := NewMagickWand;
> >     status := MagickReadImage(ImageWand,PChar(AInputFileName));
> >     if (status = MagickTrue) then
> >     begin
> >       //use a pixel iterator to draw a diagonal line
> >       Iterator:=NewPixelIterator(ImageWand);
> >       if assigned(Iterator) then
> >       begin
> >         //return the next row as an array of pixel wands
> >         PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);
> >         RowIndex := 0;
> >         while assigned(PixelWands) do
> >         begin
> >           inc(PixelWands,RowIndex); //move to the pixel wand at
> column=row
> >           PixelSetColor(PixelWands^,'#224466');
> >           PixelSyncIterator(Iterator);
> >           PixelWands:=PixelGetNextIteratorRow(Iterator,WandCount);
> >           inc(RowIndex);
> >         end;
> >       end;
> >
> >       MagickWriteImage(ImageWand,PChar(AOutputFileName));
> >     end;
> >   finally
> >     DestroyPixelIterator(Iterator);
> >     DestroyMagickWand(ImageWand);
> >   end;
> > end;
> >
> > initialization
> >   MagickWandGenesis;
> >
> > finalization
> >   MagickWandTerminus;
> >
> >
> > ....and put the following in pixel_iterator.inc
> >
> > //****correction*****
> > function NewPixelIterator(wand: PMagickWand): PPixelIterator; cdecl;
> > external WandExport;
> >
> > //****extra declaration****
> > function PixelGetNextIteratorRow(iterator: PPixeliterator; var
> columnCount
> > : Cardinal) : PPPixelWand; cdecl; external WandExport;
> >
> > I compiled this in Kylix. Let me know if you have any problems.
> > Todd.
> >
> > On Wednesday 19 Apr 2006 03:54, Phil Middlemiss wrote:
> >
> >
> >  Yeah, I've got the source and looked through the API.
> >
> >  >From what I can see of the API though, it jumps straight down into the
> >  > fine details of documenting each method and doesn't have anything
> that
> >  > tells you "This is the general approach to use".
> >
> >  For example, I see that there is a routine called
> MagickSetFirstIterator
> > (among other iteration routines) but nowhere does it describe the way to
> > set up an iteration, or even what you are iterating. There is a pixel
> wand
> > too (and a pixel iterator), but I can't find anything that describes the
> > overall method of using them.
> >
> >  Have you got any examples (I don't care if they are not documented)
> that I
> > could look at?
> >
> >  Cheers,
> >  Phil.
> >
> >  Todd Martin wrote:
> > Hi Phil
> >
> > Have you looked at the API documents?
> > {myInstallDirectoryForImageMagic}/share/doc/ImageMagick-6.2.6/www/api
> >
> > Are you running Windows or Linux? Do you have the ImageMagic source or
> just
> > a binary download?
> >
> > Todd.
> >
> > On Wednesday 19 Apr 2006 02:39, Phil Middlemiss wrote:
> >
> >
> > Hi all,
> >
> > I'm trying to understand Image Magick - I have got the Lazerus headers
> > and compiled and run the sample app listed on the wiki page for it. All
> > fine.
> >
> > Now when it comes to actually working out how to use the thing I'm not
> > sure how to go about it. The documentation is a little different from
> > the actual Lazerus files, and even if it were the same it is lacking the
> > whole "This is the overview/paradigm" section.
> >
> > What I really need is a good example that does more than just read in an
> > image and save it to another format. Does anyone has some
> > examples/documentation that they are willing to share?
> >
> > Cheers,
> > Phil.
> >
> >
> > _______________________________________________
> > Delphi mailing list
> > Delphi at ns3.123.co.nz
> > http://ns3.123.co.nz/mailman/listinfo/delphi
> >
> >
> > _______________________________________________
> > Delphi mailing list
> > Delphi at ns3.123.co.nz
> > http://ns3.123.co.nz/mailman/listinfo/delphi
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20060420/fb49e7e4/attachment-0001.html


More information about the Delphi mailing list