Le code suivant utilise Java pour diviser l'image en plusieurs parties.
La copie de code est la suivante:
Segmentation de classe publique Image {
La segmentation publique de l'icône statique (String ImageName, Int Width, int Height, int Height, int largeth) lève l'exception {
// Préparez-vous à diviser l'image
BufferedImage img1 = imageo.read (nouveau fichier (ImageName));
int half_w = img1.getWidth ();
int rgb [] = new int [half_w * img1.getheight ()];
img1.getrgb (0, 0, half_w, img1.getheight (), rgb, 0, half_w);
BufferedImage img_half = new BufferedImage (half_w, img1.getheight (), bufferedImage.type_int_argb);
img_half.setrgb (largeur, hauteur, hauteur, img1.getheight (), rgb, largeur, half_w);
Icon returnIcon = new ImageIcon (img_half);
retour returnIcon;
}
}