Lab1

Lab1 – ImageConverter

java2-lab1-ImageConverter

 

Lab1_1~ Lab1_4 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (2~3장)를 넣고 Lab1_학번_이름.zip 압축한 후 e-learning(http://lms.dankook.ac.kr/index.jsp)으로 제출

 

Lab1_1 – command line arguments

Lab1_2 – method

Lab1_3 – class

Lab1_4 – try/catch/throw & for-loop

Lab1_5 – Scanner 클래스 & do/while-loop

static boolean convert(String inputImageFile, String outputImageFile, String format) throws IOException {

// file I/O

FileInputStream inputStream = new FileInputStream(inputImageFile);

FileOutputStream outputStream = new FileOutputStream(outputImageFile);

  // reads input image from file

BufferedImage inputImage = ImageIO.read(inputStream);     

// writes to the output image in specified format

  boolean result = ImageIO.write(inputImage, format, outputStream);

// needs to close the streams

outputStream.close();

inputStream.close();

// return result(true/false)

  return result;

}