-1
300 개의 이미지 파일 이름 배열을 가지고 있으며 각 파일 이름을 새로운 BufferedImage로 변환하고자합니다.Java - 파일 [] 항목을 BufferedImage로 변환
300 이미지 이름의배열하여 만들어집니다
//Default image directory (to convert to greyscale).
static File dir = new File("images");
//Array of original image filenames.
static File imgList[] = dir.listFiles();
public static void processGreyscale(){
if(dir.isDirectory()){
for(File img : imgList){
if(img.isFile()){
//functions are carried out here.
}
else{
//functions are carried out here.
}
}
}
}
의 라인을 따라 뭔가를 사용하여 BufferedImage
항목을 모두 imgList[x]
항목을 변환하는 방법이 : 나는 솔루션 아래에 희망
File file = new File(new BufferedImage(imgList[0-300]));
try {
image = ImageIO.read(file);
} catch (IOException e) {
...
}
코드의 2 비트가 이해가되지 않으며, 컴파일되지 않습니다. File 배열을 반복하고 ImageIO로 각각로드합니다. 각로드는 이미지를 반환합니다. [Java 자습서] (http://docs.oracle.com/javase/tutorial/2d/images/loadimage.html)를 참조하십시오.) 이에. – DNA
두 번째 부분은 이론적으로 볼 수있는 코드 조각이기 때문에 컴파일되지 않습니다. – MusTheDataGuy