Package ca.carleton.gcrc.olkit.multimedia.imageMagick

Examples of ca.carleton.gcrc.olkit.multimedia.imageMagick.ImageMagickProcessor


    ImageMagickInfo imInfo = ImageMagick.getInfo();
   
    // Get information about image
    ImageInfo imageInfo = null;
    if( imInfo.isAvailable ){
      ImageMagickProcessor imageMagick = imInfo.getProcessor();
      imageInfo = imageMagick.getImageInfo( inFile );
    }

    if( null != imageInfo ) {
      request.setInHeight( imageInfo.height );
      request.setInWidth( imageInfo.width );
    }
   
    // Create thumbnail
    if( null != imageInfo && request.isThumbnailRequested() ){
      String outputExtension = getExtensionFromImageFormat(imageInfo.format);
      if( null == outputExtension ){
        outputExtension = "jpg";
      }

      File thumbnailFile = request.getThumbnailFile();
      if( null == thumbnailFile ) {
        File parentDir = inFile.getParentFile();

        String name = inFile.getName();
        int index = name.lastIndexOf('.');
        if( index > 0 ) {
          name = name.substring(0, index);
        }
        name = name+"_thumb."+outputExtension;
       
        thumbnailFile = new File(parentDir, name);
      }

      ImageMagickProcessor im = imInfo.getProcessor(progress);
      im.resizeImage(imageInfo, thumbnailFile, IMAGE_THUMB_WIDTH, IMAGE_THUMB_HEIGHT);
     
      request.setThumbnailFile(thumbnailFile);
      request.setThumbnailCreated(true);

      ImageInfo thumbImageInfo = im.getImageInfo( thumbnailFile );
      request.setThumbnailHeight( thumbImageInfo.height );
      request.setThumbnailWidth( thumbImageInfo.width );
    }
  }
View Full Code Here


    AttachmentDescriptor attDescription = conversionContext.getAttachmentDescription();
    String mimeType = attDescription.getContentType();
    File outputFile = File.createTempFile("original_", attDescription.getMediaFileName());
    conversionContext.downloadFile(outputFile);
   
    ImageMagickProcessor imp = ImageMagick.getInfo().getProcessor();
    ImageInfo imageInfo = imp.getImageInfo(outputFile);
   
    if( imageInfo.orientation == ImageInfo.Orientation.REQUIRES_CONVERSION ){
      File convertedFile = File.createTempFile("oriented_", attDescription.getMediaFileName());
      imp.reorientImage(outputFile, convertedFile);
      attDescription.uploadFile(convertedFile, mimeType);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
View Full Code Here

    AttachmentDescriptor attDescription = conversionContext.getAttachmentDescription();
    String mimeType = attDescription.getContentType();
    File outputFile = File.createTempFile("original_", attDescription.getMediaFileName());
    conversionContext.downloadFile(outputFile);
   
    ImageMagickProcessor imp = ImageMagick.getInfo().getProcessor();
    ImageInfo imageInfo = imp.getImageInfo(outputFile);
   
    if( imageInfo.orientation == ImageInfo.Orientation.REQUIRES_CONVERSION ){
      File convertedFile = File.createTempFile("oriented_", attDescription.getMediaFileName());
      imp.reorientImage(outputFile, convertedFile);
      attDescription.uploadFile(convertedFile, mimeType);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
View Full Code Here

    AttachmentDescriptor attDescription = conversionContext.getAttachmentDescription();
    String mimeType = attDescription.getContentType();
    File outputFile = File.createTempFile("original_", attDescription.getMediaFileName());
    conversionContext.downloadFile(outputFile);
   
    ImageMagickProcessor imp = ImageMagick.getInfo().getProcessor();
    ImageInfo imageInfo = imp.getImageInfo(outputFile);
   
    if( imageInfo.orientation == ImageInfo.Orientation.REQUIRES_CONVERSION ){
      File convertedFile = File.createTempFile("oriented_", attDescription.getMediaFileName());
      imp.reorientImage(outputFile, convertedFile);
      attDescription.uploadFile(convertedFile, mimeType);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.olkit.multimedia.imageMagick.ImageMagickProcessor

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.