2025-12-19 10:49:27 +01:00
|
|
|
package fr.iutfbleau.sae;
|
|
|
|
|
|
2025-12-20 11:54:06 +01:00
|
|
|
import java.awt.*;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
2025-12-19 10:49:27 +01:00
|
|
|
|
|
|
|
|
public class ConverterController {
|
2025-12-20 11:54:06 +01:00
|
|
|
|
|
|
|
|
public BufferedImage loadImage(File f){
|
|
|
|
|
//verification si le fichier contient quelque chose, si il est exesistant et si c'est un fichier "normal" d'apres la javadoc.
|
|
|
|
|
if (f == null || !f.exists() || !f.isFile()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
BufferedImage image;
|
|
|
|
|
try {
|
|
|
|
|
image = ImageIO.read(f);
|
2025-12-26 19:49:39 +01:00
|
|
|
} catch (IOException e){
|
2025-12-20 11:54:06 +01:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return image;
|
2025-12-19 10:49:27 +01:00
|
|
|
|
2025-12-26 19:49:39 +01:00
|
|
|
}
|
2025-12-19 10:49:27 +01:00
|
|
|
}
|