From 707d2f55c0cc0f125083f60a401739f1806078b0 Mon Sep 17 00:00:00 2001 From: eudes chatin Date: Fri, 13 Sep 2019 09:07:02 +0200 Subject: [PATCH] ajout classe recadrage --- NGCC/src/lecturePdf/Recadrage.java | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 NGCC/src/lecturePdf/Recadrage.java diff --git a/NGCC/src/lecturePdf/Recadrage.java b/NGCC/src/lecturePdf/Recadrage.java new file mode 100644 index 0000000..28f1c0c --- /dev/null +++ b/NGCC/src/lecturePdf/Recadrage.java @@ -0,0 +1,53 @@ +package lecturePdf; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + +public class Recadrage { + String dir=""; + String filename=""; + BufferedImage img; + + + public Recadrage(String directory,String file) { + dir=directory; + filename=file; + File f =new File(dir+filename); + + try { + img=ImageIO.read(f); + } catch (IOException e) { + System.out.println(e); + } + } + + public boolean estDroite() { //determine si l'image png/jpg du pdf est droite + int count=0; + boolean stop=false; + for (int ty=0; ty<100 && !stop;ty++) { + for (int tx=0;tximg.getWidth()/5.4 && count