Package is.us.thirdparty

Examples of is.us.thirdparty.ImageInfo


   * See ImageInfo.java for information on provided data and a list of formats it handles.
   *
   * @param imageData The image data.
   */
  public static ImageInfo imageInfo( byte[] imageData ) {
    ImageInfo ii = new ImageInfo();
    ii.setInput( new ByteArrayInputStream( imageData ) );

    if( !ii.check() ) {
      return null;
    }

    return ii;
  }
View Full Code Here


  @Test
  public void testOriginal() {
    try {
      BufferedImage bi2 = ImageIO.read( new File( TEST_IMAGE_PATH ) );
      byte[] bytes50 = USImageUtilities.encode( bi2, 50, CodecType.JPEG );
      ImageInfo info = USImageUtilities.imageInfo( bytes50 );
      assertEquals( info.getFormat(), ImageInfo.FORMAT_JPEG );
      assertEquals( info.getWidth(), 126 );
    }
    catch( Exception e ) {
      fail( e.getMessage() );
    }
  }
View Full Code Here

  public void encode() {
    try {
      // test 10% quality
      BufferedImage bi = ImageIO.read( new File( TEST_IMAGE_PATH ) );
      byte[] bytes10 = USImageUtilities.encode( bi, 10, CodecType.JPEG );
      ImageInfo info = USImageUtilities.imageInfo( bytes10 );
      assertEquals( info.getFormat(), ImageInfo.FORMAT_JPEG );

      // test 50% quality
      BufferedImage bi2 = ImageIO.read( new File( TEST_IMAGE_PATH ) );
      byte[] bytes50 = USImageUtilities.encode( bi2, 50, CodecType.JPEG );
      info = USImageUtilities.imageInfo( bytes50 );
      assertEquals( info.getFormat(), ImageInfo.FORMAT_JPEG );
    }
    catch( Exception e ) {
      fail( e.getMessage() );
    }
  }
View Full Code Here

  @Test
  public void testScale() {
    try {
      byte[] input = USDataUtilities.readBytesFromFile( new File( TEST_IMAGE_PATH ) );
      byte[] bytes = USImageUtilities.scale( input, 150, 150, 100, CodecType.JPEG );
      ImageInfo info = USImageUtilities.imageInfo( bytes );
      assertEquals( info.getWidth(), 150 );
      assertEquals( info.getHeight(), 150 );
    }
    catch( Exception e ) {
      fail( e.getMessage() );
    }
  }
View Full Code Here

  @Test
  public void thumbnaleScale() {
    try {
      byte[] input = USDataUtilities.readBytesFromFile( new File( TEST_IMAGE_PATH ) );
      byte[] bytes = USImageUtilities.createThumbnail( input, 50, 50, 100, CodecType.PNG );
      ImageInfo info = USImageUtilities.imageInfo( bytes );
      assertEquals( info.getWidth(), 50 );
      assertEquals( info.getHeight(), 37 );
    }
    catch( Exception e ) {
      fail( e.getMessage() );
    }
  }
View Full Code Here

TOP

Related Classes of is.us.thirdparty.ImageInfo

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.