In a Chrome App (packaged app), I have FileEntry objects that represent JPEG images, and I'd like to show them as thumbnails. However, it seems that the only way to access the image data is in its entirety, with the FileEntry.file method, which produces a File (subclass of Blob). As some of the images are >4MB, this is way too inefficient for showing, say, 50 thumbnails in the window.

Am I correct that there is no API for accessing just the thumbnail, or is there some HTML5 or Chrome API that I'm missing?

[Clarification: When I say "extract thumbnail", I mean reading just the thumbnail data, which is inside nearly all JPEGs. I don't mean extracting the primary compressed JPEG data and showing it thumbnail size, nor do I mean reading the binary data and pulling out the part that represents the thumbnail, as that still means reading into memory the whole file.]

有帮助吗?

解决方案 2

Comment from sowbug to my OP is the answer I was looking for.

其他提示

As a general proposition, it is possible to read the thumbnail without decompressing the image.

The location of the Thumbnail depends upon the specific JPEG file format used. JPEG itself, does not define thumbnails.

That said, my experience is that very few JPEG files actually contain thumbnails.

I would check the file format headers (e.g., EXIF, JPEG) to see if there actually are thumbnails in your images.

You may have to extract the thumbnails yourself from the headers display them. In JFIF, the thumbnail may either be uncompressed or it may be a nested JFIF stream.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top