Package net.sourceforge.jiu.codecs

Examples of net.sourceforge.jiu.codecs.ImageCodec


    index = outputFileName.lastIndexOf(".");
    if (index != -1)
    {
      outputFileName = outputFileName.substring(0, index);
    }
    ImageCodec codec = null;
    switch(settings.fileFormat)
    {
      case(JiuConvertSettings.FORMAT_BMP):
      {
        codec = new BMPCodec();
        break;
      }
      case(JiuConvertSettings.FORMAT_PALM):
      {
        codec = new PalmCodec();
        break;
      }
      case(JiuConvertSettings.FORMAT_PNM):
      {
        codec = new PNMCodec();
        break;
      }
    }
    String ext = codec.suggestFileExtension(image);
    if (ext != null)
    {
      outputFileName += ext;
    }
    File outputFile = new File(settings.destinationDirectory, outputFileName);
    outputFileName = outputFile.getAbsolutePath();
    if (outputFile.exists() && !settings.overwrite)
    {
      println(JiuConvertSettings.VERBOSITY_NORMAL, settings, " File \"" + outputFileName + "\" already exists, skipping.");
    }
    codec.setImage(image);
    try
    {
      codec.setFile(outputFileName, CodecMode.SAVE);
      codec.process();
      codec.close();
      println(JiuConvertSettings.VERBOSITY_NORMAL, settings, " Wrote \"" + outputFileName + "\".");
    }
    catch (IOException ioe)
    {
      println(JiuConvertSettings.VERBOSITY_HIGH, settings, " I/O error writing \"" + outputFileName + "\": " + ioe.toString());
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.codecs.ImageCodec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.