Package org.im4java.core

Examples of org.im4java.core.IMOperation


    String tiffPath = tiff.getFile().getAbsolutePath();
    String jp2Path = currentPath + File.separator + "sample.jp2";

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

    IMOperation op = new IMOperation();
    op.addImage(tiffPath);
    op.addImage("jp2:-");

    Pipe pipe = new Pipe(null, byteArrayOutputStream);

    ConvertCmd convert = new ConvertCmd();
    convert.setOutputConsumer(pipe);
View Full Code Here


      tmpJp2.deleteOnExit();
    } catch (IOException e2) {
      e2.printStackTrace();
    }

    IMOperation op = new IMOperation();
    op.addImage(tmpTiff.getAbsolutePath());
    op.resize(maxHeight, maxWidth);
    op.addImage(tmpJp2.getAbsolutePath());

    ConvertCmd convert = new ConvertCmd();
    try {
      convert.run(op);
    } catch (IOException e) {
View Full Code Here

      tmpTn.deleteOnExit();
    } catch (IOException e2) {
      e2.printStackTrace();
    }

    IMOperation op = new IMOperation();
    op.thumbnail(150);
    op.addImage(tmpJp2.getAbsolutePath());
    op.addImage(tmpTn.getAbsolutePath());

    ConvertCmd convert = new ConvertCmd();
    try {
      convert.run(op);
    } catch (IOException e) {
View Full Code Here

        try {
            // create command
            ConvertCmd cmd = new ConvertCmd();

            // create the operation, add images and operators/options
            IMOperation op = new IMOperation();
            op.addImage(getFile(iw).getPath());

            if(square) {
                op.resize(size,size,"^");
                op.gravity("center");
                op.crop(size,size,0,0);
            } else {
                op.resize(size,size);
            }

            op.addImage(outputFile.getPath());

            cmd.run(op);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
View Full Code Here

        try {
            // create command
            ConvertCmd cmd = new ConvertCmd();

            // create the operation, add images and operators/options
            IMOperation op = new IMOperation();
            op.addImage(getFile(i).getPath());
            op.crop(width, height, left, top);
            op.addImage(outputFile.getPath());

            cmd.run(op);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
View Full Code Here

        try {
            // create command
            ConvertCmd cmd = new ConvertCmd();

            // create the operation, add images and operators/options
            IMOperation op = new IMOperation();
            op.addImage(getFile(i).getPath());
            op.resize(width, height);
            op.addImage(outputFile.getPath());

            cmd.run(op);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
View Full Code Here

        try {
            // create command
            ConvertCmd cmd = new ConvertCmd();

            // create the operation, add images and operators/options
            IMOperation op = new IMOperation();
            op.addImage(getFile(i).getPath());
            op.rotate(clockwise ? 90. : -90.);
            op.addImage(outputFile.getPath());

            cmd.run(op);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
View Full Code Here

   
    public static File getThumbnailFile(File f) throws IOException, InterruptedException, IM4JavaException {
      File f2 = new File(f.getParentFile(), f.getName() + ".jpg");
      f2.deleteOnExit();
      ConvertCmd cmd = new ConvertCmd();
    IMOperation op = new IMOperation();
    op.addImage(f.getAbsolutePath());
    op.thumbnail(width, height);
    op.addImage(f2.getAbsolutePath());
        if (MediaFilterManager.isVerbose) {
        System.out.println("IM Thumbnail Param: "+op);
        }
    cmd.run(op);
    return f2;
View Full Code Here

   
    public static File getImageFile(File f, int page) throws IOException, InterruptedException, IM4JavaException {
      File f2 = new File(f.getParentFile(), f.getName() + ".jpg");
      f2.deleteOnExit();
      ConvertCmd cmd = new ConvertCmd();
    IMOperation op = new IMOperation();
    String s = "[" + page + "]";
    op.addImage(f.getAbsolutePath()+s);
    op.addImage(f2.getAbsolutePath());
        if (MediaFilterManager.isVerbose) {
        System.out.println("IM Image Param: "+op);
        }
    cmd.run(op);
    return f2;
View Full Code Here

   * @return <code>true</code> if the library is available
   */
  private boolean imageMagickAvailable() {
    try {
      ConvertCmd cmd = new ConvertCmd();
      IMOperation versionOp = new IMOperation();
      versionOp.version();
      cmd.run(versionOp);
      logger.debug("ImageMagick detected and found to be working");
      return true;
    } catch (Throwable e) {
      logger.info("ImageMagick not available: {}", e.getMessage());
View Full Code Here

TOP

Related Classes of org.im4java.core.IMOperation

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.