How to set "distort:viewport=WxH" for the distort function in magick++?
-
- Posts: 5
- Joined: 2018-07-06T21:08:17-07:00
- Authentication code: 1152
How to set "distort:viewport=WxH" for the distort function in magick++?
I have found distort function has only 4 parameters in magick++, such as Image.distort(PerspectiveDistortion,16,point_4,false). Now i want to define "distort:viewport=WxH" to get a specified output. What do i do?
-
- Posts: 5
- Joined: 2018-07-06T21:08:17-07:00
- Authentication code: 1152
Re: How to set "distort:viewport=WxH" for the distort function in magick++?
Thanks very much, and now, i have another problem: i use the following codes to get a specified output with transparent background. But the background is not transparent overall, it has a corner with gray color. Is there something wrong of the code?
Code: Select all
Image image( filename );
image.artifact("distort:viewport","540x960");
image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod);
image.distort(PerspectiveDistortion,16,point_4,false);
image.write("distort.png");
-
- Posts: 5
- Joined: 2018-07-06T21:08:17-07:00
- Authentication code: 1152
Re: How to set "distort:viewport=WxH" for the distort function in magick++?
Thanks very much. I have found the problem. I corrected my code as follows, it is work for me.lq634254672 wrote: ↑2018-07-07T08:48:00-07:00Thanks very much, and now, i have another problem: i use the following codes to get a specified output with transparent background. But the background is not transparent overall, it has a corner with gray color. Is there something wrong of the code?
Code: Select all
Image image( filename ); image.artifact("distort:viewport","540x960"); image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod); image.distort(PerspectiveDistortion,16,point_4,false); image.write("distort.png");
Code: Select all
image.artifact("distort:viewport","540x960");
image.matteColor(Color("transparent") );
image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod);
image.distort(PerspectiveDistortion,16,point_4,false);
image.write("distort.png");