Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, February 15, 2013 11:54:24 AM(UTC)

EdS  
EdS

Groups: Registered
Posts: 11


I have a (large) set of existing tiff images. I need to read their tiff tag values, as well as ensure this metadata is maintained when I save them to another format (in particular, jp2).

However, I see no metadata when I load these images, though obviously it exists (any tiff file contains a large number of tag fields with values, they have to).

Using the following code, the Tags and Comments collections are empty.

<font face="Lucida Console" size="2">
using (var codec = new RasterCodecs())
{
codec.Options.Load.Comments = true;
codec.Options.Load.Tags = true;
using (var image = codec.Load(pathToTiff))
{
// image.Tags is empty, as is image.Comments
}
}
</font>


Additionally, all calls to RasterCodec.ReadTag using mandatory tiff tags (or tags I know to be populated, like ImageDescription) return null. What is the recommended way of reading metadata from pre-existing images?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, February 17, 2013 6:46:50 AM(UTC)

Ibrahim  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Some tags are automatically added to the image's tags collection or saved to the image with the values you specify manually. These include tags that are set by other means, such as the bitmap's width and height, which are taken from the bitmap properties and not from the tags collection.

If you want to force saving a TIFF tag or comment, you can do that using the WriteTag() or WriteComment() methods.

Please note that the JP2 format does not support all TIFF tags.
In fact, our toolkit only supports two JP2 comments and no tags at all. For more information, refer to the following online help topic:
http://leadtools.com/help/leadtools/v18/dh/to/leadtools.topics.leadtools~l.topics.jpeg2000filecomments.html

If you need both tags and JP2 compression, you can store JP2-compressed pages into TIFF files. Is this what you're trying to do?
 
#3 Posted : Thursday, February 21, 2013 3:34:54 PM(UTC)

EdS  
EdS

Groups: Registered
Posts: 11


Thanks for the reply. Unfortunately this is still a bit confusing for me.

I would think (hope) that the "Comments" would just transfer over since they are really file format independent constructs. They do not, as a simple conversion from a tiff -> jp2 -> tiff will show. The end result contains no Comment metadata.

I need this data to persist when converting. Our customers will be able to convert from any format to any other format, so we need some simple mechanism to transfer them over. I'd prefer to not have to jump through hoops and check file types to do it; all I want is a simple description, which every format I am using here supports in one form or another.

I may just be missing something. I tried RasterCodecs.Write comment and I get a "Feature Not Supported" exception. I realize this means I have no referenced some particular assembly, but I get it even after referencing *every* Leadtools.Codecs.XXX assembly you provide. Your documentation doesn't say anything about which assembly this implementation resides in.

Even that method is suboptimal however. It requires the file to be on disk or saved to a stream, which seems wholly unnecessary. Additionally, I have to check for different formats so that I can use different comment types which, while viable, is a total pain and again, seems like it shouldn't be necessary given that the "Comments" abstraction exists.

If I programmatically add a comment to a jp2 image and save it as a tif, the description field is not populated. This is my problem, as is the reverse situation. Can you propose any kind of simple, robust method for persisting metadata, even if only a single comment?
 
#4 Posted : Thursday, February 21, 2013 3:53:49 PM(UTC)

EdS  
EdS

Groups: Registered
Posts: 11


Tried to edit this in, but I just wanted to say that I realize I may very well be missing something simple. This SDK is pretty new to me. Just looking for a simple way to preserve the most simple form of metadata out there.
 
#5 Posted : Sunday, February 24, 2013 4:33:08 AM(UTC)

Ibrahim  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Comments are NOT format-independent.
Some formats support them (mainly TIFF and JPEG) while others don't (such as BMP or PNG).

There is no general converter that will transform all comments from one format to the other arbitrarily. If your application is going to support multiple formats, you will need to know a few things about the differences between the capabilities of each format.

About "Feature Not Supported", this doesn't always mean you're missing a DLL. It could mean you're trying to do something to a format that does not support what you're trying to do.

About needing the image file without having it on disk or in a stream, this does not apply to how LEADTOOLS handles images.
An image is of a certain format (such as TIFF, JPEG or JPEG2000) only when it's saved to a file either on disk or in memory.

When you load it into a LEAD bitmap, it is no longer of the original format it used to be. This means a bitmap loaded into a LEADTOOLS object or structure cannot be "TIFF" or "GIF" or "JPEG". It is simply an image. It is NOT an "image file format".
 
#6 Posted : Wednesday, February 27, 2013 7:27:57 AM(UTC)

EdS  
EdS

Groups: Registered
Posts: 11


I know that metadata formats are not format independent at the file level (your abstraction just makes it seem that way). Of course, in this instance, I *am* converting between two formats which allow for them.

This stuff could easily be implemented in the library instead of pushing it off to the users of the API to check the format, pull out a "Comment" from the original TIFF and add it back as a "Latin" ("Latin"? Really?) comment in the jp2. Oh well.
 
#7 Posted : Thursday, February 28, 2013 6:39:59 AM(UTC)

Ibrahim  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Although JPEG2000 allows for XML and XMP metadata, our toolkit currently does not have functions to convert from EXIF and JPEG comments to J2K metadata in these formats.

If you would like to submit a feature request regarding this, you can send an email from a valid address to support@leadtools.com and mention this post.

Edit by moderator:
Newer versions of LEADTOOLS contain support for reading and writing XMP metadata in different formats including PNG, PDF, JPEG, TIFF and SVG.

Edited by moderator Thursday, December 1, 2016 3:24:20 PM(UTC)  | Reason: Not specified

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.162 seconds.