A simple call to the decoder's GetMetadataQueryReader method gets the decoder's query reader. Similarly, a query reader can also be obtained at the decoder level. Hr = pFrameDecode->GetMetadataQueryReader(&pQueryReader) The following code demonstrates this call. To obtain the frame's query reader, make a simple call to the frame's GetMetadataQueryReader method. Alternatively, you could use the other WICDecodeOptions value, WICDecodeMetadataCacheOnLoad, which caches the embedded image metadata as soon as the image is loaded. Using this option enables you to retain the stream to the metadata required for fast metadata encoding and enables lossless decoding of the JPEG image. This tells the decoder to cache the metadata when the metadata is needed either by obtaining a query reader or the underlying metadata reader. In this method, the fourth parameter is set to the value WICDecodeMetadataCacheOnDemand from the WICDecodeOptions enumeration. The bitmap decoder for the test.jpg file is obtained by using the CreateDecoderFromFilename method of the imaging factory. Hr = pFactory->CreateDecoderFromFilename( IWICMetadataQueryReader *pEmbedReader = NULL IWICMetadataQueryReader *pQueryReader = NULL IWICBitmapFrameDecode *pFrameDecode = NULL This code also performs setup work needed to obtain a query reader from a decoded frame. The following example code shows how to obtain a bitmap decoder from the imaging factory and retrieve an individual bitmap frame. There are three ways to obtain a query reader: through a bitmap decoder ( IWICBitmapDecoder), through its individual frames ( IWICBitmapFrameDecode), or through a query writer ( IWICMetadataQueryWriter). The query reader enables you to read metadata blocks and items within metadata blocks using a query expression. The easiest way to read metadata is to use the query reader interface, IWICMetadataQueryReader. The image represented by this diagram was created by using Microsoft Paint the rating metadata was added by using the Photo Gallery feature of Windows Vista. The following diagram of the contents of a JPEG image file is used throughout the examples in this topic. The two types of metadata handlers available are the metadata reader ( IWICMetadataReader) and the metadata writer ( IWICMetadataWriter). A metadata handler is obtained from the individual frames using a block reader ( IWICMetadataBlockReader) or a block writer ( IWICMetadataBlockWriter). The more advanced method is to directly access the metadata handlers. Behind the scenes, a query reader (and writer) uses a metadata handler to access the metadata described by the query expression. Both of these use a query expression to read or write the desired metadata. A query reader ( IWICMetadataQueryReader) is used to read metadata while a query writer ( IWICMetadataQueryWriter) is used to write metadata. The easiest of these is to use a query reader/writer and a query expression to access the metadata. Using a metadata handler (a metadata reader or a metadata writer) to access the nested metadata blocks or specific metadata within the metadata blocks.Using a query reader/writer and a query expression to query metadata blocks for nested blocks or specific metadata within a block.There are two ways to read and write metadata: WIC provides application developers with Component Object Model (COM) components to read and write metadata embedded in image files. You should also be familiar with the query language used to read and write metadata, as described in Metadata Query Language Overview. To understand this topic, you should be familiar with the WIC metadata system as described in the WIC Metadata Overview. Reading Metadadata Using a Query Reader.This topic contains the following sections. This topic provides an overview of how you can use the Windows Imaging Component (WIC) APIs to read and write metadata that is embedded in image files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |