• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IImageMetadata类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.imaging.common.IImageMetadata的典型用法代码示例。如果您正苦于以下问题:Java IImageMetadata类的具体用法?Java IImageMetadata怎么用?Java IImageMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IImageMetadata类属于org.apache.commons.imaging.common包,在下文中一共展示了IImageMetadata类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
@Override
public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException {
    final List<PngChunk> chunks = readChunks(byteSource, new ChunkType[] { ChunkType.tEXt, ChunkType.zTXt, }, true);

    if ((chunks == null) || (chunks.isEmpty())) {
        return null;
    }

    final ImageMetadata result = new ImageMetadata();

    for (PngChunk chunk : chunks) {
        final PngTextChunk textChunk = (PngTextChunk) chunk;

        result.add(textChunk.getKeyword(), textChunk.getText());
    }

    return result;
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:20,代码来源:PngImageParser.java


示例2: setExifGPSTag

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
/**
 * This method sets the EXIF the of the JPEG file and outputs it to given directory.
 * @param jpegImageFile
 * 		Input jpeg file.
 * @param dst
 * 		output jpeg file.
 * @param longitude
 * 		Longitude to be tagged.
 * @param latitude
 * 	 	Latitude to be tagged.
 * @throws IOException
 * @throws ImageReadException
 * @throws ImageWriteException
 */
public static void setExifGPSTag(final File jpegImageFile, final File dst, final double longitude, final double latitude) throws IOException,
ImageReadException, ImageWriteException {
	OutputStream os = null;
	boolean canThrow = false;
	try {

		final IImageMetadata metadata = Imaging.getMetadata(jpegImageFile);
		final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
		TiffOutputSet outputSet = setTiffOutputSet(jpegMetadata, longitude, latitude);
		os = new FileOutputStream(dst);
		os = new BufferedOutputStream(os);
		new ExifRewriter().updateExifMetadataLossless(jpegImageFile, os, outputSet);
		canThrow = true;
	} finally {
		IoUtils.closeQuietly(canThrow, os);
	}
}
 
开发者ID:codailama,项目名称:GeoTagPhotos,代码行数:32,代码来源:EXIFUtils.java


示例3: getExif

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
private static TiffImageMetadata getExif(final File file) {
    TiffImageMetadata exif = null;
    try {
        final IImageMetadata metadata = Imaging.getMetadata(file);
        if (metadata != null) {
            final JpegImageMetadata jpegMetadata
                    = (JpegImageMetadata) metadata;
            exif = jpegMetadata.getExif();
        } else {
            log(Level.WARNING, String.format(
                    "No metadata found for file %s", file));
        }

    }
    catch (final ImageReadException | IOException ex) {
        Logger.getLogger(PhotoLoader.class.getName()).
                log(Level.SEVERE, null, ex);
    }
    return exif;
}
 
开发者ID:consulion,项目名称:jeotag,代码行数:21,代码来源:PhotoLoader.java


示例4: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
@Override
public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException {
    final TiffImageMetadata exif = getExifMetadata(byteSource, params);

    final JpegPhotoshopMetadata photoshop = getPhotoshopMetadata(byteSource,
            params);

    if (null == exif && null == photoshop) {
        return null;
    }

    return new JpegImageMetadata(photoshop, exif);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:15,代码来源:JpegImageParser.java


示例5: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
@Override
public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException {
    final RgbeInfo info = new RgbeInfo(byteSource);
    boolean canThrow = false;
    try {
        final IImageMetadata ret = info.getMetadata();
        canThrow = true;
        return ret;
    } finally {
        IoUtils.closeQuietly(canThrow, info);
    }
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:14,代码来源:RgbeImageParser.java


示例6: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
IImageMetadata getMetadata() throws IOException, ImageReadException {
    if (null == metadata) {
        readMetadata();
    }

    return metadata;
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:8,代码来源:RgbeInfo.java


示例7: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
@Override
public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException {
    final FormatCompliance formatCompliance = FormatCompliance.getDefault();
    final TiffReader tiffReader = new TiffReader(isStrict(params));
    final TiffContents contents = tiffReader.readContents(byteSource, params,
            formatCompliance);

    final List<TiffDirectory> directories = contents.directories;

    final TiffImageMetadata result = new TiffImageMetadata(contents);

    for (TiffDirectory dir : directories) {
        final TiffImageMetadata.Directory metadataDirectory = new TiffImageMetadata.Directory(
                tiffReader.getByteOrder(), dir);

        final List<TiffField> entries = dir.getDirectoryEntries();

        for (TiffField entry : entries) {
            metadataDirectory.add(entry);
        }

        result.add(metadataDirectory);
    }

    return result;
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:28,代码来源:TiffImageParser.java


示例8: getImageMetaData

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
/**
	 * Updated metadata from the image file
	 * 
	 * @param isReadThumbnail
	 * @return Returns image metadata <b>with</b> image thumbnail <b>only</b> when
	 *         <code>isReadThumbnail</code> is <code>true</code>, otherwise it checks if metadata
	 *         are already loaded.
	 */
	public IImageMetadata getImageMetaData(final Boolean isReadThumbnail) {

		if (_photoImageMetadata != null && isReadThumbnail == false) {

			// meta data are available but the exif thumnail is not requested

			return null;
		}

		if (PhotoLoadManager.isImageLoadingError(imageFilePathName)) {
			// image could not be loaded previously
			return null;
		}

		IImageMetadata imageFileMetadata = null;

		try {

			/*
			 * read metadata WITH thumbnail image info, this is the default when the pamameter is
			 * ommitted
			 */
			final HashMap<String, Object> params = new HashMap<String, Object>();
			params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, isReadThumbnail);

//			final long start = System.currentTimeMillis();

			imageFileMetadata = Imaging.getMetadata(imageFile, params);

//			System.out.println(UI.timeStamp()
//					+ Thread.currentThread().getName()
//					+ "read exif\t"
//					+ ((System.currentTimeMillis() - start) + " ms")
//					+ ("\tWithThumb: " + isReadThumbnail)
//					+ ("\t" + imageFilePathName)
//			//
//					);
//			// TODO remove SYSTEM.OUT.PRINTLN
//
//			System.out.println(imageFileMetadata);
//			// TODO remove SYSTEM.OUT.PRINTLN

		} catch (final Exception e) {

			StatusUtil.log(NLS.bind(//
					"Could not read metadata from image \"{0}\"", //$NON-NLS-1$
					imageFile));

			PhotoLoadManager.putPhotoInLoadingErrorMap(imageFilePathName);

		} finally {

			final PhotoImageMetadata photoImageMetadata = createPhotoMetadata(imageFileMetadata);

			updateImageMetadata(photoImageMetadata);
		}

		return imageFileMetadata;
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:68,代码来源:Photo.java


示例9: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
@Override
public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException {
    return null;
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:6,代码来源:XbmImageParser.java


示例10: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
private static IImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException {
    final ImageParser imageParser = getImageParser(byteSource);

    return imageParser.getMetadata(byteSource, params);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:7,代码来源:Imaging.java


示例11: getMetadata

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
/**
 * Get image metadata from the specified file.  Format-specific
 * ImageParser implementations are expected to return a valid
 * IImageMetadata object or to throw an ImageReadException if unable
 * to process the specified data.
 * 
 * <p>The params argument provides a mechanism for individual
 * implementations to pass optional information into the parser.
 * Not all formats will require this capability.  Because the
 * base class may call this method with a null params argument,
 * implementations should <strong>always</strong> include logic
 * for ignoring null input.
 *
 * @param file   A valid reference to a file.
 * @param params Optional instructions for special-handling or
 *               interpretation of the input data (null objects are permitted and
 *               must be supported by implementations).
 * @return A valid image metadata object describing the content extracted
 *         from  the specified content.
 * @throws ImageReadException In the event that the the specified content
 *                            does not conform to the format of the specific
 *                            parser implementation.
 * @throws IOException        In the event of unsuccessful file read or
 *                            access operation.
 */
public final IImageMetadata getMetadata(final File file, final Map<String, Object> params)
        throws ImageReadException, IOException {
    if (getDebug()) {
        System.out.println(getName() + ".getMetadata" + ": "
                + file.getName());
    }

    if (!canAcceptExtension(file)) {
        return null;
    }

    return getMetadata(new ByteSourceFile(file), params);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:39,代码来源:ImageParser.java


示例12: geoTagAllImages

import org.apache.commons.imaging.common.IImageMetadata; //导入依赖的package包/类
/**
 * To GeoTag all the images.
 * 
 * @param inputDirectoryPath
 * 		input directory to all the images. 
 * @param kmlDirectoryPath
 * 		Directory in which KML files reside!
 * @param outputDirectoryPath
 * 		Output directory to all the files.
 * @throws ImageReadException
 * @throws IOException
 * @throws ParseException
 * @throws ImageWriteException
 * @throws DatatypeConfigurationException 
 * @throws XMLStreamException 
 */
public static void geoTagAllImages(String inputDirectoryPath, String kmlDirectoryPath, String outputDirectoryPath) throws ImageReadException, IOException, ParseException, ImageWriteException, XMLStreamException, DatatypeConfigurationException{
	File inputDirectory = new File(inputDirectoryPath);
	File[] inputImages = inputDirectory.listFiles();
	Map<When, Coord> kmlMap = loadAllKMLtoMap(kmlDirectoryPath);
	for(File inputImage : inputImages){
		final IImageMetadata metadata = Imaging.getMetadata(inputImage);
		final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
		File outputImage = new File(outputDirectoryPath, inputImage.getName());
		Long timestamp = getTimeStampFromImage(jpegMetadata);
		Coord coord = KMLUtils.getCoordinateByTime(kmlMap, timestamp, GxEnum.APPROXIMATE);
		setExifGPSTag(inputImage, outputImage, coord.getLatitude(), coord.getLongitude());
	}
}
 
开发者ID:codailama,项目名称:GeoTagPhotos,代码行数:30,代码来源:EXIFUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BufferedLineReader类代码示例发布时间:2022-05-23
下一篇:
Java ContentType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap