Examples of encodeImage()


Examples of hipi.image.io.ImageEncoder.encodeImage()

    for (int i = 0; i < fileName.length; i++)
    {
      pis = new FileInputStream("data/test/JPEGImageUtilTestCase/truth/" + fileName[i] + ".ppm");
      image = decoder.decodeImage(pis);
      jos = new FileOutputStream("/tmp/" + fileName[i] + ".jpg");
      encoder.encodeImage(image, null, jos);
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("compare -metric PSNR data/test/JPEGImageUtilTestCase/truth/" + fileName[i] + ".ppm /tmp/" + fileName[i] + ".jpg /tmp/psnr.png");
      Scanner scanner = new Scanner(new InputStreamReader(pr.getErrorStream()));
      float psnr = scanner.hasNextFloat() ? scanner.nextFloat() : 0;
      assertTrue(fileName[i] + " PSNR is too low : " + psnr, psnr > 30);
View Full Code Here

Examples of hipi.image.io.ImageEncoder.encodeImage()

    for (int i = 0; i < fileName.length; i++)
    {
      pis = new FileInputStream("data/test/PNGImageUtilTestCase/truth/" + fileName[i] + ".ppm");
      image = decoder.decodeImage(pis);
      pos = new FileOutputStream("/tmp/" + fileName[i] + ".png");
      encoder.encodeImage(image, null, pos);
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("compare -metric MSE data/test/PNGImageUtilTestCase/truth/" + fileName[i] + ".ppm /tmp/" + fileName[i] + ".png /tmp/psnr.png");
      Scanner scanner = new Scanner(new InputStreamReader(pr.getErrorStream()));
      float mse = scanner.hasNextFloat() ? scanner.nextFloat() : -1;
      assertTrue(fileName[i] + " MSE is too high : " + mse, mse == 0);
View Full Code Here

Examples of hipi.image.io.ImageEncoder.encodeImage()

    public void map(ImageHeader key, FloatImage value, Context context)
    throws IOException, InterruptedException {
      if(value != null){
        ImageEncoder encoder = JPEGImageUtil.getInstance();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        encoder.encodeImage(value, key, os);
        os.close();
        byte[] val = os.toByteArray();
        long sig = 0<<2 | ImageType.JPEG_IMAGE.toValue();
        context.write(new LongWritable(sig), new BytesWritable(val));
      }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.image.encode.ImageEncoder.encodeImage()

    try
    {
      ImageEncoder encoder = _getImageEncoder(context, properties);
      assert (encoder != null);

      encoder.encodeImage(image, out);
    }
    catch (IOException e)
    {
      _error(e);
    }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.image.encode.ImageEncoder.encodeImage()

    try
    {
      ImageEncoder encoder = _getImageEncoder(context, properties);
      assert (encoder != null);

      encoder.encodeImage(image, out);
    }
    catch (IOException e)
    {
      _error(e);
    }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.image.encode.ImageEncoder.encodeImage()

    try
    {
      ImageEncoder encoder = _getImageEncoder(context, properties);
      assert (encoder != null);

      encoder.encodeImage(image, out);
    }
    catch (IOException e)
    {
      _error(e);
    }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.image.encode.ImageEncoder.encodeImage()

    try
    {
      ImageEncoder encoder = _getImageEncoder(context, properties);
      assert (encoder != null);

      encoder.encodeImage(image, out);
    }
    catch (IOException e)
    {
      _error(e);
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.encoder.ImageEncoder.encodeImage()

      final ContentItem contentItem =
          contentLocation.createItem(nameGenerator.generateName(null, mimeType));
      final BufferedImage image = interceptor.getImage();
      final ImageEncoder imageEncoder = ImageEncoderRegistry.getInstance().createEncoder(mimeType);
      final OutputStream outputStream = contentItem.getOutputStream();
      imageEncoder.encodeImage(image, outputStream, quality, alphaChannel);
      outputStream.close();
    }
    catch (Throwable e)
    {
      setError(e);
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.encoder.ImageEncoder.encodeImage()

    if (imageEncoder == null)
    {
      throw new UnsupportedEncoderException("The encoder for mime-type '" + mimeType + "' is not available");
    }

    imageEncoder.encodeImage(image, outputStream, quality, alpha);
  }

  public static Image scaleImage(final Image img,
                                 final int targetWidth,
                                 final int targetHeight,
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.encoder.ImageEncoder.encodeImage()

  private byte[] createPngImage() throws UnsupportedEncoderException, IOException
  {
    final ImageEncoder imageEncoder = ImageEncoderRegistry.getInstance().createEncoder(mimeType);
    assertNotNull(imageEncoder);
    final ByteArrayOutputStream bout = new ByteArrayOutputStream();
    imageEncoder.encodeImage(new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB), bout, 0.75f, false);
    return bout.toByteArray();
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.