I want to achieve this Emboss effect using ImageMagick's C API. The script is from this page. I have achieved emboss for method 1 option but I'm looking to convert for method 2. Please look at the options in bash script.
When I debug above script for method 2 I've got this.
convert -quiet binaryimage.gif +repage ./emboss_1_18210.mpc
convert '(' ./emboss_1_18210.mpc -colorspace gray ')' '(' -clone 0 -negate ')' '(' -clone 0 -distort SRT '0,0 1 0 -2.12132,-2.12132' ')' '(' -clone 1 -distort SRT '0,0 1 0 2.12132,2.12132' ')' -delete 0,1 -define compose:args=50 -compose blend -composite -level 100% ./emboss_2_18210.mpc
convert ./emboss_2_18210.mpc binaryimageCm2.gif
Below id my C program, it's not done yet.
#include <stdio.h>
#include <MagickWand/MagickWand.h>
#include <math.h>
#define PI 3.14159265
double *arguments(double r[],int i){
double azimuth = 135;
int depth = 6;
r[0] = 0;
r[1] = 0;
r[2] = 1;
r[3] = 0;
if(i==1){
r[4] = cos(0.78539816339) * depth/2;
r[5] = sin(0.78539816339) * depth/2;
}else{
r[4] = -cos(0.78539816339) * depth/2;
r[5] = -sin(0.78539816339) * depth/2;
}
return(r);
}
int emboss(){
double r[6];
MagickWand *wand = NULL;
wand = NewMagickWand();
MagickReadImage(wand,"binaryimage.gif");
int test = MagickSetImageColorspace(wand, 3);
printf("%d\n", test);
MagickDistortImage(wand, ScaleRotateTranslateDistortion ,6, arguments(r,0) ,1);
MagickDistortImage(wand, ScaleRotateTranslateDistortion ,6, arguments(r,1) ,1);
MagickNegateImage(wand,1);
MagickCompositeImage(wand, wand, BlendCompositeOp, 1, 0, 0);
MagickWriteImages(wand,"binaryimage_c_emboss.gif",MagickTrue);
wand=DestroyMagickWand(wand);
MagickWandTerminus();
return 1;
}
int main(int argc, char **argv) {
emboss();
}