source: project/wiki/eggref/4/image-dimensions @ 37493

Last change on this file since 37493 was 37493, checked in by wasamasa, 18 months ago

image-dimensions: Add C4 docs

File size: 2.5 KB
Line 
1== image-dimensions
2
3[[toc:]]
4
5=== Introduction
6
7Scheme port of the
8[[https://github.com/sstephenson/dimensions|dimensions gem]] for
9reading the width, height and rotation of GIF, PNG, TIFF and JPEG
10images.  For JPEG images orientation in EXIF metadata is automatically
11detected and applied to width and height.  Errors are raised for
12unknown image formats and other conditions preventing a successful
13read.
14
15=== Author
16
17Vasilij Schneidermann
18
19=== Repository
20
21[[https://github.com/wasamasa/image-dimensions]]
22
23=== API
24
25<procedure>(image-dimensions input-port)</procedure>
26<procedure>(image-info input-port)</procedure>
27
28Procedures accepting an input port and returning a list of attributes.
29{{image-dimensions}} returns a list of width and height,
30{{image-info}} returns a list of the image type symbol, width, height
31and rotation angle in degrees.  The rotation is always set to zero for
32non-JPEG images; JPEG images with EXIF metadata may have a non-zero
33rotation.
34
35Used image type symbols:
36
37* {{gif}}
38* {{png}}
39* {{tiff}}
40* {{jpeg}}
41
42=== Example
43
44<enscript highlight="scheme">
45(use image-dimensions)
46
47(call-with-input-file "10x20.png" image-info) ;=> (png 10 20 0)
48(call-with-input-file "10x20.png" image-dimensions) ;=> (10 20)
49(call-with-input-file "10x20.jpg" image-info) ;=> (jpeg 10 20 0)
50(call-with-input-file "10x20.jpg" image-dimensions) ;=> (10 20)
51</enscript>
52
53=== License
54
55 Copyright (c) 2018, Vasilij Schneidermann
56 
57 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:
58 
59 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
60 
61 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.
62
63=== Version History
64
65==== 0.1
66
67* Initial release
Note: See TracBrowser for help on using the repository browser.