简体   繁体   中英

Is it possible to check image dimensions without loading it [actionscript-3]?

I would like to check image size without downloading it (images are located on servers), is it possible? I found that great class http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/ but its only for JPEG, and It would be nice to have something for png as well. That class was written 5 years ago, so was there created anything like that and/or for other kinds of images, since then? I searched google without luck.

Christophe Herreman claimed that he wrote something like this for PNG but after inspection - it's something essentially different.

You may start to load the file, read the bytes at the beginning of the file, get the dimensions from there and stop loading. Here is the PNG format specification. After 8 bytes of signature , you may find what you need .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM