Repository navigation
Releases: leafo/imagesize
Releases · leafo/imagesize
Release list
v1.1.0
New formats
- WebP: lossy (VP8), lossless (VP8L), and extended (VP8X) files, including alpha and animation. Animated files report the canvas size. Needs at most 30 bytes.
- BMP: Windows and OS/2 bitmaps, including top-down files with a negative height. Returns
bit_depth. - MP4: new
imagesize.mp4module withdetect_mp4(read, file_size)anddetect_mp4_from_bytes(bytes). It takes a read callback sincemoovis often at the end of the file, so only the box headers andmoovneed to be fetched (typically 3 to 5 reads). Returns the first video track'swidth,height, androtation, theduration, thebrand, and every track'shandlerandcodec. See the README for details.
Changes
- GIF size now matches browsers. The logical screen size is used, falling back to the first frame's size when it is larger or the file is GIF87a. Previously the first frame's size was always used, so animated GIFs whose first frame is smaller than the canvas will now report a larger size.
- JPEGs with an EXIF orientation tag return an
orientationfield (1 to 8).widthandheightare still the stored dimensions, so for orientations 5 to 8 the displayed image has them swapped. - Dimensions are integers on Lua 5.3+. Previously they were floats, eg.
50.0.
Fixes
- A JPEG segment with a length of 0 or 1 raised a Lua error instead of returning
nil. - A JPEG with a few hundred APP1 segments raised a backtrack stack overflow error.
- JPEGs using SOF3, SOF5 to SOF7, SOF9 to SOF11, or SOF13 to SOF15 (lossless, arithmetic, and hierarchical) failed to detect.
- JPEGs with
0xFFfill bytes before a marker failed to detect. - GIFs with application extensions other than NETSCAPE (eg. XMP or ICC profiles), plain text extensions, empty comments, or unknown extensions failed to detect.
Other
- Tested on Lua 5.1 through 5.5, LuaJIT, and OpenResty's LuaJIT.
Full Changelog: v1.0.0...v1.1.0
Initial release
https://luarocks.org/modules/leafo/imagesize
Initial release, see README for useage.