Hi there, this works dandy in ImageMagick CLI
convert red-eye.jpg -region 24x14+72+115 -channel red -modulate 100,70 output.jpg
I can't for the life of me figure out how to duplicate this in MagickWand
Any help appreciated.
Mapping IM commands , reduce red channell for 'red eye'
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
[edit]Oooops. I meant to reply to your post in the MagickWand forum. Oh well.
I think this does what you wanted
I'd be interested if anyone has a better/alternate method.
Pete
I think this does what you wanted
I'd be interested if anyone has a better/alternate method.
Pete
Code: Select all
MagickWand *magick_wand = NULL,*region_wand = NULL;
int dx,dy,x,y;
MagickWandGenesis();
magick_wand = NewMagickWand();
MagickReadImage(magick_wand,"magick.jpg");
// Specify the region's (x,y) coordinate
x = 115;
y = 25;
// and its width and height
dx = 40;
dy = 40;
// and extract it
region_wand = MagickGetImageRegion(magick_wand,dx,dy,x,y);
// Modulate the region
MagickModulateImage(region_wand,50,70,0);
// and now copy the red channel back
MagickCompositeImageChannel(magick_wand,RedChannel,region_wand,CopyCompositeOp,x,y);
MagickWriteImage(magick_wand,"magick_red_eye.jpg");
/* Clean up */
if(magick_wand)magick_wand = DestroyMagickWand(magick_wand);
if(region_wand)region_wand = DestroyMagickWand(region_wand);
MagickWandTerminus();
Hmm
well, that technique is a start, i end up with some very green images..
currently trying to figure out
MagickFxImage , which it would seem nobody has ever used before.. ever.
Doesn't seem to matter what i pass in, it doesn't do anything..
I was tring fx strings, like this
MagickFxImage( $region_wand, "u.r /2",MW_RedChannel );
but quickly realised it did nothing, and neither does this
MagickFxImage( $region_wand, "xxxxxxxxxxxxxxxxxxxxxx",MW_RedChannel );
MagickWand is really, really cryptic, and almost not documented at all... I'm pretty surprised by all that..
currently trying to figure out
MagickFxImage , which it would seem nobody has ever used before.. ever.
Doesn't seem to matter what i pass in, it doesn't do anything..
I was tring fx strings, like this
MagickFxImage( $region_wand, "u.r /2",MW_RedChannel );
but quickly realised it did nothing, and neither does this
MagickFxImage( $region_wand, "xxxxxxxxxxxxxxxxxxxxxx",MW_RedChannel );
MagickWand is really, really cryptic, and almost not documented at all... I'm pretty surprised by all that..
Did you try
- fx_wand = MagickFxImageChannel( $region_wand, "u /2", MW_RedChannel );
Last edited by magick on 2006-12-01T07:47:42-07:00, edited 1 time in total.
i did.
It's great to see an admin involved!!
I did, it would seem , to me, that the magickwand api returns a wand, but that the php implementation of it actually returns a magickwand boolean (true | false )
I've found this discrepency in other areas as well..
I will double check though.
I did, it would seem , to me, that the magickwand api returns a wand, but that the php implementation of it actually returns a magickwand boolean (true | false )
I've found this discrepency in other areas as well..
I will double check though.