All Downloads are FREE. Search and download functionalities are using the official Maven repository.

moska4.straightentext.straighten-image.1.0.source-code.Main Maven / Gradle / Ivy

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class Main {

    public static void main(String[] args){
        System.out.println("HELLO");

        String path = "C:\\Users\\Anonymous\\Desktop\\GitHub\\Straighten_Image\\sample\\";
        File img = new File(path + "input3.png");

        try {
            BufferedImage image = ImageIO.read(img);
            BufferedImage rotated = StraightenText.straightenText(image);
            saveBufferedIm(rotated, path + "rotate3.png");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    //Metodo per salvare su disco una BufferedImage
    public static void saveBufferedIm(BufferedImage image, String path){
        //file object
        File f;
        //write image
        try{
            f = new File(path);
            ImageIO.write(image, "png", f);
        }catch(IOException e){
            System.out.println("Error: " + e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy