当前位置: 首页>>代码示例>>Java>>正文


Java Sanselan.getBufferedImage方法代码示例

本文整理汇总了Java中org.apache.sanselan.Sanselan.getBufferedImage方法的典型用法代码示例。如果您正苦于以下问题:Java Sanselan.getBufferedImage方法的具体用法?Java Sanselan.getBufferedImage怎么用?Java Sanselan.getBufferedImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.sanselan.Sanselan的用法示例。


在下文中一共展示了Sanselan.getBufferedImage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readIconData

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
private IconData readIconData(byte[] iconData, IconInfo fIconInfo)
        throws ImageReadException, IOException
{
    ImageFormat imageFormat = Sanselan.guessFormat(iconData);
    if (imageFormat.equals(ImageFormat.IMAGE_FORMAT_PNG))
    {
        BufferedImage bufferedImage = Sanselan.getBufferedImage(iconData);
        PNGIconData pngIconData = new PNGIconData(fIconInfo, bufferedImage);
        return pngIconData;
    }
    else
    {
        try
        {
            return readBitmapIconData(iconData, fIconInfo);
        }
        catch (ImageWriteException imageWriteException)
        {
            IOException ioe = new IOException();
            ioe.initCause(imageWriteException);
            throw ioe;
        }
    }
}
 
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:25,代码来源:IcoImageParser.java

示例2: imageRead

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
/**
 * Read RGB array data from image file
 * @param fileName Image file name
 * @return RGB array data
 * @throws java.io.IOException
 * @throws org.apache.sanselan.ImageReadException
 */
public static Array imageRead(String fileName) throws IOException, ImageReadException{
    String extension = fileName.substring(fileName.lastIndexOf('.') + 1);
    BufferedImage image;
    if (extension.equalsIgnoreCase("jpg") || extension.equalsIgnoreCase("jpeg")){
        image = ImageIO.read(new File(fileName));
    } else {
        image = Sanselan.getBufferedImage(new File(fileName));
    }
    return imageRead(image);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:18,代码来源:ImageUtil.java

示例3: imageLoad

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
/**
 * Load image from image file
 * @param fileName Image file name
 * @return Image
 * @throws java.io.IOException
 * @throws org.apache.sanselan.ImageReadException
 */
public static BufferedImage imageLoad(String fileName) throws IOException, ImageReadException{
    String extension = fileName.substring(fileName.lastIndexOf('.') + 1);
    BufferedImage image;
    if (extension.equalsIgnoreCase("jpg") || extension.equalsIgnoreCase("jpeg")){
        image = ImageIO.read(new File(fileName));
    } else {
        image = Sanselan.getBufferedImage(new File(fileName));
    }
    return image;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:18,代码来源:ImageUtil.java

示例4: toBufferedImage

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
/**
 * translate a file resource to a buffered image
 * @param res
 * @return
 * @throws IOException
 */
public final BufferedImage toBufferedImage(Resource res,String format) throws IOException {
	InputStream is=null;
	try {
		return Sanselan.getBufferedImage(is=res.getInputStream());
	} 
	catch (ImageReadException e) {
		throw ExceptionUtil.toIOException(e);
	}
	finally {
		IOUtil.closeEL(is);
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:19,代码来源:SanselanCoder.java

示例5: imageWriteExample

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
public static byte[] imageWriteExample(final File file)
		throws ImageReadException, ImageWriteException, IOException {
	// read image
	final BufferedImage image = Sanselan.getBufferedImage(file);
	final ImageFormat format = ImageFormat.IMAGE_FORMAT_TIFF;
	final Map<String, Object> params = new HashMap<String, Object>();

	// set optional parameters if you like
	params.put(SanselanConstants.PARAM_KEY_COMPRESSION, new Integer(
			TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED));

	final byte[] bytes = Sanselan.writeImageToBytes(image, format, params);
	return bytes;
}
 
开发者ID:shaolinwu,项目名称:uimaster,代码行数:15,代码来源:ImageUtil.java

示例6: imageReadExample

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
public static BufferedImage imageReadExample(final File file)
        throws ImageReadException, IOException {
    final Map<String, Object> params = new HashMap<String, Object>();

    // set optional parameters if you like
    params.put(SanselanConstants.BUFFERED_IMAGE_FACTORY,
            new ManagedImageBufferedImageFactory());

    // params.put(ImagingConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);

    // read image
    final BufferedImage image = Sanselan.getBufferedImage(file, params);
    return image;
}
 
开发者ID:shaolinwu,项目名称:uimaster,代码行数:15,代码来源:ImageUtil.java

示例7: toBufferedImage

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
/**
 * translate a binary array to a buffered image
 * @param binary
 * @return
 * @throws IOException
 */
public final BufferedImage toBufferedImage(byte[] bytes,String format) throws IOException {
	try {
		return Sanselan.getBufferedImage(new ByteArrayInputStream(bytes));
	} 
	catch (ImageReadException e) {
		throw new IOException(e);
	}
}
 
开发者ID:shaolinwu,项目名称:uimaster,代码行数:15,代码来源:ImageUtil.java

示例8: read

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
@Override
public BufferedImage read(byte[] imageBytes) throws IOException {
	try {
		return Sanselan.getBufferedImage(imageBytes);
	} catch (ImageReadException e) {
		throw new IOException(e);
	}
}
 
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:9,代码来源:ServiceImageIO.java

示例9: readPng

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
public static BufferedImage readPng(InputStream is)
    throws ImageReadException, IOException {
  return Sanselan.getBufferedImage(is);
}
 
开发者ID:inevo,项目名称:shindig-1.1-BETA5-incubating,代码行数:5,代码来源:PNGOptimizer.java

示例10: readBmp

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
public static BufferedImage readBmp(InputStream is)
    throws ImageReadException, IOException {
  return Sanselan.getBufferedImage(is);
}
 
开发者ID:inevo,项目名称:shindig-1.1-BETA5-incubating,代码行数:5,代码来源:BMPOptimizer.java

示例11: readGif

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
public static BufferedImage readGif(InputStream is)
    throws ImageReadException, IOException {
  return Sanselan.getBufferedImage(is);
}
 
开发者ID:inevo,项目名称:shindig-1.1-BETA5-incubating,代码行数:5,代码来源:GIFOptimizer.java

示例12: read

import org.apache.sanselan.Sanselan; //导入方法依赖的package包/类
/**
 * Returns a <code>BufferedImage</code> as the result of decoding a supplied
 * <code>InputStream</code> with an <code>ImageReader</code> chosen
 * automatically from among those currently registered. The
 * <code>InputStream</code> is wrapped in an <code>ImageInputStream</code>.
 * If no registered <code>ImageReader</code> claims to be able to read the
 * resulting stream, <code>null</code> is returned.
 *
 * <p>
 * The current cache settings from <code>getUseCache</code>and
 * <code>getCacheDirectory</code> will be used to control caching in the
 * <code>ImageInputStream</code> that is created.
 *
 * <p>
 * This method does not attempt to locate <code>ImageReader</code>s that can
 * read directly from an <code>InputStream</code>; that may be accomplished
 * using <code>IIORegistry</code> and <code>ImageReaderSpi</code>.
 *
 * <p>
 * This method <em>does not</em> close the provided <code>InputStream</code>
 * after the read operation has completed; it is the responsibility of the
 * caller to close the stream, if desired.
 *
 * @param input
 *            an <code>InputStream</code> to read from.
 *
 * @return a <code>BufferedImage</code> containing the decoded contents of
 *         the input, or <code>null</code>.
 *
 * @exception IllegalArgumentException
 *                if <code>input</code> is <code>null</code>.
 * @exception IOException
 *                if an error occurs during reading.
 */
public static BufferedImage read(InputStream input) throws IOException {
	if (input == null) {
		throw new IllegalArgumentException("input == null!");
	}

	final NonClosableInputStream buffer = new NonClosableInputStream(input);
	buffer.mark(100 * 1024 * 1024); // 100mb is big enough?

	BufferedImage bi;
	try {
		bi = readInternal(buffer);
	} catch (final Exception ex) {
		bi = null;
	}

	if (bi == null) {
		buffer.reset();
		try {
			bi = Sanselan.getBufferedImage(buffer);
		} catch (final Throwable e) {
			throw new IOException(e);
		}
	}

	return bi;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:61,代码来源:ExtendedImageIO.java


注:本文中的org.apache.sanselan.Sanselan.getBufferedImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。