Closed Bug 167303 Opened 22 years ago Closed 13 years ago

backend support for image metadata

Categories

(Core :: Graphics: ImageLib, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Biesinger, Unassigned)

References

(Blocks 1 open bug)

Details

bug 18779 and bug 106068 require that imagelib supports passing image metadata over to a frontend-accessible way. I will implement it by doing this: o) Add a function OnMetadata(in AString aName, in AString aData) to imgIDecoderObserver o) the image decoders will call this function whenever they see metadata in the image o) nsImageFrame will pass these notifications over to nsHTMLImageElement o) nsHTMLImageElement will store them in a hash table or something to access the data from the frontend, I will add two functions to nsIDOMNSHTMLImageElement and implement them in nsHTMLImageElement, namely these: AString getMetadata(AString name); enumMetadata(); // not sure yet how such a function would be best implemented. this can be decided later.
cc'ing db48x because he might be interested in this for page info
cc'ing people who can't get enough bugmail :) reading comment 0 it should be clear where I will need the string->string mapping.
ok. so the above approach approach was disliked by some layout people and by the imagelib owner. pushing to future.
Target Milestone: --- → Future
Hopefully the imagelib people find a consensus on how to implement that function soon. Lacking this function Mozilla will not be able to display e.g. JPEG comments, a functionality that good ol' Netscape 4.x has!
ok, cc'ing the people I discussed that with on IRC... hope I got them right, it's been some time. also cc'ing tor since this is loosely related to imagelib, though it will not be part of it (on stuart's request) I suppose I'd go this way: o) Create an interface, say "imgIMetadataLoader" or something o) has the methods: void loadFromURI(nsIURI aURI, imgIMetadataListener); where the listener has a function "void onMetadata(string name, string data);" for name-value pairs of metadata which will be called for each metadata item. loadFromURI will load the uri (maybe from cache only) and parse it for metadata... maybe it will do that with help from other components (like, @mozilla.org/image-metadata;1?type=image/foo" where image/foo depends on the image type). Any comments?
Can't you do this entirely from Javascript by scripting Necko to load the URI data and then parsing the data in Javascript itself? Sure, it'd be slow, but collecting the metadata doesn't need to be high performance.
No comments on the implementation. (don't take that negatively) To clarify Comment #4 a bit, there was a lot of negativity towards loading meta data at time of image load (why waste memory, CPU cycles), and the concensus was it would be okay to re-read the image (from cache) when Page Info is displayed in order to get the meta data. Which is what Comment #5 seems to be trying to do (I think)
well, I don't really like javascript :) and I am not sure if js is a good language for parsing arrays of bytes, or if it's even easy to get at them (no idea if necessary APIs are scriptable; I'd have to check)
Priority: -- → P5
Note that we will soon have access to imgIRequests and imgIContainers that have already been loaded in the relevant code (as in, anywhere). Would it be possible to make imgIContainer go and parse the metadata on request?
Assignee: cbiesinger → jdunn
Blocks: 232806
Blocks: 24126
Severity: normal → enhancement
OS: Linux → All
Priority: P5 → --
Hardware: PC → All
Target Milestone: Future → ---
Assignee: jdunn → nobody
QA Contact: tpreston → imagelib
QA Contact: imagelib → joe
This should be implemented inside add-ons or frontend code by doing something like an XHR for the raw data, then parsing whatever metadata you want in javascript. We don't want to implement metadata inside imagelib.
Status: NEW → RESOLVED
Closed: 13 years ago
QA Contact: joe → imagelib
Resolution: --- → WONTFIX
(In reply to Joe Drew (:JOEDREW!) from comment #10) > ...by doing something like an XHR for the raw data,... Assume the image is served by a web cam, updated every second, contained in a web page and the image has already been loaded once. If the raw image data has to be loaded by an add-on through an XMLHttpRequest, is it guaranteed to see the same data or will the second request fetch a different (updated) image data?
Another option, which we would be willing to implement, is a getter for the raw image data. That wouldn't rely on cache behaviour at all.
You need to log in before you can comment on or make changes to this bug.