@@ -0,0 +1,2091 @@
+package org.mg.javalib.util;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0A%0Aimport javax.swing.ImageIcon;%0A%0Apublic class ImageConvertUtil%0A%7B%0A    public static void distortPerspective(String source, String dest, double ratio, boolean parallel)%0A            throws IOException%0A    %7B%0A        ImageIcon img = new ImageIcon(source);%0A%0A        int w = img.getIconWidth();%0A        int h = img.getIconHeight();%0A%0A        int offset = (int) (w * ratio / 2.0);%0A        int yTopRight = offset;%0A        int yBottomLeft, yBottomRight;%0A        if (parallel)%0A        %7B%0A            yBottomLeft = h - offset;%0A            yBottomRight = h;%0A        %7D%0A        else%0A        %7B%0A            yBottomLeft = h;%0A            yBottomRight = h - offset;%0A        %7D%0A%0A        String cmd%5B%5D = %7B %22convert%22, source, %22-matte%22, %22-virtual-pixel%22, %22transparent%22, %22-distort%22, %22Perspective%22, // %0A                %220,0 0,0 %22//top left%0A                        + w + %22,0 %22 + w + %22,%22 + yTopRight + %22 %22//top right%0A                        + w + %22,%22 + h + %22 %22 + w + %22,%22 + yBottomRight + %22  %22 //bottom right%0A                        + %220,%22 + h + %22 0,%22 + yBottomLeft//bottom left %0A                , dest %7D;%0A        System.out.println(ArrayUtil.toString(cmd, %22 %22, %22%22, %22%22, %22%22));%0A        Runtime.getRuntime().exec(cmd);%0A    %7D%0A%0A    public static void distortPerspectiveInFolder(String srcFolder, String dstFolder, double ratio) throws IOException%0A    %7B%0A        for (String f : new File(srcFolder).list())%0A        %7B%0A            if (f.endsWith(%22png%22))%0A            %7B%0A                System.out.println(f);%0A                distortPerspective(srcFolder + %22/%22 + f, dstFolder + %22/%22 + f, ratio, true);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) throws IOException%0A    %7B%0A        distortPerspectiveInFolder(%22/home/martin/documents/ecfps/latex/pics/%22,%0A                %22/home/martin/documents/ecfps/latex/pics/distorted%22, 0.1);%0A%0A        //        distortPerspective(%22/home/martin/documents/ecfps/latex/pics/prediction.png%22,%0A        //                %22/home/martin/documents/ecfps/latex/pics/prediction_distorted.png%22, 0.2);%0A    %7D%0A%7D%0A

add convert util