Scheme port of the dimensions gem for reading the width, height and rotation of GIF, PNG, TIFF and JPEG images. For JPEG images orientation in EXIF metadata is automatically detected and applied to width and height. Errors are raised for unknown image formats and other conditions preventing a successful read.
- image-dimensions input-portprocedure
- image-info input-portprocedure
Procedures accepting an input port and returning a list of attributes. image-dimensions returns a list of width and height, image-info returns a list of the image type symbol, width, height and rotation angle in degrees. The rotation is always set to zero for non-JPEG images; JPEG images with EXIF metadata may have a non-zero rotation.
Used image type symbols:
(use image-dimensions) (call-with-input-file "10x20.png" image-info) ;=> (png 10 20 0) (call-with-input-file "10x20.png" image-dimensions) ;=> (10 20) (call-with-input-file "10x20.jpg" image-info) ;=> (jpeg 10 20 0) (call-with-input-file "10x20.jpg" image-dimensions) ;=> (10 20)
Copyright (c) 2018, Vasilij Schneidermann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Initial release