perspective distorsion problem
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
perspective distorsion problem
dear friends, got an issue with perspective distorsion,maybe you can help me
1) ive been using imagemagick for a long time, all works great, now im trying for the first time to do a simple perspective distorsion, like any of these, in php :
$command= "convert ".$source." -matte -virtual-pixel transparent -distort Perspective '7,40 124,330 4,124 4,223 85,122 400,123 85,2 200,30' ".$target;
$command= "convert ".$source." -matte -virtual-pixel transparent -distort Perspective '0,0,0,0 0,90,0,90 90,0,90,25 90,90,90,65' ".$target;
but nothing happens, no change in the result, anything im doing wrong? my version of imagemagick is the latest
2) the other thing is, if i have a sequence like this
$command= 'convert -size 1000x631 xc:none ';
$command .='-draw "image over 0,0 0,0 \''.$source1.'\'" ';
$command .='-draw "image over 0,0 0,0 \''.$source2.'\'" ';
$command .='-draw "image over 0,0 0,0 \''.$source3.'\'" ';
$command.=' -quality 85 '.$target;
can i apply to one of those sources a perspective distorsion with resizing included and include it all in the same command? if so, how?
thanks so very much for your help as always
Jav
1) ive been using imagemagick for a long time, all works great, now im trying for the first time to do a simple perspective distorsion, like any of these, in php :
$command= "convert ".$source." -matte -virtual-pixel transparent -distort Perspective '7,40 124,330 4,124 4,223 85,122 400,123 85,2 200,30' ".$target;
$command= "convert ".$source." -matte -virtual-pixel transparent -distort Perspective '0,0,0,0 0,90,0,90 90,0,90,25 90,90,90,65' ".$target;
but nothing happens, no change in the result, anything im doing wrong? my version of imagemagick is the latest
2) the other thing is, if i have a sequence like this
$command= 'convert -size 1000x631 xc:none ';
$command .='-draw "image over 0,0 0,0 \''.$source1.'\'" ';
$command .='-draw "image over 0,0 0,0 \''.$source2.'\'" ';
$command .='-draw "image over 0,0 0,0 \''.$source3.'\'" ';
$command.=' -quality 85 '.$target;
can i apply to one of those sources a perspective distorsion with resizing included and include it all in the same command? if so, how?
thanks so very much for your help as always
Jav
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
regarding 2)
basically im uniting many images within a large virtual canvas
and i need to distort in perspective one of them, so how do i include it all within the same command?
thanks very much
Jav
basically im uniting many images within a large virtual canvas
and i need to distort in perspective one of them, so how do i include it all within the same command?
thanks very much
Jav
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
mmm i dont get it, now i tried this example you have and still nothing no change, i tried both in windows and linux, mmm, what do u think?
$p1="0,0";
$p2="680,0";
$p3="680,952";
$p4="0,952";
$w1="298,488";
$w2="431,472";
$w3="497,590";
$w4="370,616";
$points="$p1 $w1 $p2 $w2 $p3 $w3 $p4 $w4";
echo "***";
echo $points;
echo "***";
# process picture in perspective and overlay on wizard
$command= " convert ".$source1." ( ".$pic." -channel rgba -alpha set -virtual-pixel transparent +distort perspective '".$points."' ) -compose over -layers merge ".$target2;
passthru($command);
$p1="0,0";
$p2="680,0";
$p3="680,952";
$p4="0,952";
$w1="298,488";
$w2="431,472";
$w3="497,590";
$w4="370,616";
$points="$p1 $w1 $p2 $w2 $p3 $w3 $p4 $w4";
echo "***";
echo $points;
echo "***";
# process picture in perspective and overlay on wizard
$command= " convert ".$source1." ( ".$pic." -channel rgba -alpha set -virtual-pixel transparent +distort perspective '".$points."' ) -compose over -layers merge ".$target2;
passthru($command);
Re: perspective distorsion problem
What version of IM are you using as the distort options changed at some point and why not get distort working on its own and then build it into the long convert comand?
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
i have tried with these 2 versions
6.7.0-6
and also
6.6.8-5 2011-03-18 Q16
i would prefer it all in one command for not generating temporary files, this is very important for my application
6.7.0-6
and also
6.6.8-5 2011-03-18 Q16
i would prefer it all in one command for not generating temporary files, this is very important for my application
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
i may have found a solution, not sure yet, im testing it
in the meantime, which of the perspective distorts produces the sharpest results yet being fast enough?
thanks so much
jav
in the meantime, which of the perspective distorts produces the sharpest results yet being fast enough?
thanks so much
jav
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
ok progress
this works: $command ='convert '.$source.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" '.$target;
but this doesnt work
$command= "convert ".$canvas." ( ".$source." -matte -virtual-pixel transparent -distort Perspective '".$points."' ) -compose over -layers merge ".$target;
so how can i apply the distortion and at the same time compose it over a larger canvas?
thanks so much, and is that the technique that produce sharp yet fast results?
$p1="0,0";
$p2="680,0";
$p3="680,952";
$p4="0,952";
$w1="298,488";
$w2="431,472";
$w3="497,590";
$w4="370,616";
$points="$p1 $w1 $p2 $w2 $p3 $w3 $p4 $w4";
this works: $command ='convert '.$source.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" '.$target;
but this doesnt work
$command= "convert ".$canvas." ( ".$source." -matte -virtual-pixel transparent -distort Perspective '".$points."' ) -compose over -layers merge ".$target;
so how can i apply the distortion and at the same time compose it over a larger canvas?
thanks so much, and is that the technique that produce sharp yet fast results?
$p1="0,0";
$p2="680,0";
$p3="680,952";
$p4="0,952";
$w1="298,488";
$w2="431,472";
$w3="497,590";
$w4="370,616";
$points="$p1 $w1 $p2 $w2 $p3 $w3 $p4 $w4";
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
mamma mia, it was a matter of changing quotes to the reversed ones, insane...
$command= 'convert '.$canvas.' ( '.$source.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" ) -compose over -layers merge '.$target;
uffff
thank u
so final question, is this a fast method with quite sharp results? or is there any other method that is as fast but sharper? or is this the generally used one?
thank u my friends
jav
$command= 'convert '.$canvas.' ( '.$source.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" ) -compose over -layers merge '.$target;
uffff
thank u
so final question, is this a fast method with quite sharp results? or is there any other method that is as fast but sharper? or is this the generally used one?
thank u my friends
jav
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
one more question, can i mix that command with a -draw command to compose yet another image with them?
$command= 'convert '.$source1.' ( '.$pic.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" ) ( -draw "image over 0,0 0,0 \''.$source2.'\'" ) -compose over -layers merge '.$target2;
it doesnt seem to work, thanks for any help
$command= 'convert '.$source1.' ( '.$pic.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" ) ( -draw "image over 0,0 0,0 \''.$source2.'\'" ) -compose over -layers merge '.$target2;
it doesnt seem to work, thanks for any help
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
so the question really is if i can mix both -draw and -distort in same command to compose multiple images one of which can be put in perspective, all in one command,
i already manage to make 2, the canvas + the perspective one, now how can i add more in the same command? didnt manage yet, tried with -draw but didnt work
thank u
i already manage to make 2, the canvas + the perspective one, now how can i add more in the same command? didnt manage yet, tried with -draw but didnt work
thank u
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
ah, magic of imagemagick
it works now, its just all matter of formatting, quotes etc
ay ay ay
thank u my friends
so this is the best command for perspective isnt it? seems quite fast, any other recommendation?
smiles
jav
it works now, its just all matter of formatting, quotes etc
ay ay ay
thank u my friends
so this is the best command for perspective isnt it? seems quite fast, any other recommendation?
smiles
jav
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
question
it works in windows with 6.7.0-6
but it doesnt work in linux with 6.6.8-5
is this a problem of the version? or of the syntax?
thank u
it works in windows with 6.7.0-6
but it doesnt work in linux with 6.6.8-5
is this a problem of the version? or of the syntax?
thank u
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: perspective distorsion problem
uff it works now
in linux i needed to add the \ special character before the ( and )
so final question
i see it takes a while, is there any other faster command? or this is the fastest?
i mean, its fast but just wondering if this one is the fastest?
$command =$magic.' '.$source.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" '.$target;
thank u so much
jav
in linux i needed to add the \ special character before the ( and )
so final question
i see it takes a while, is there any other faster command? or this is the fastest?
i mean, its fast but just wondering if this one is the fastest?
$command =$magic.' '.$source.' -matte -virtual-pixel transparent -distort Perspective "'.$points.'" '.$target;
thank u so much
jav