Last change
on this file since 13983 was 13983, checked in by lh92, 17 years ago |
Added for Realistic Book Project
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
914 bytes
|
Line | |
---|
1 | # NOTE: Derived from lib/Image/Size.pm.
|
---|
2 | # Changes made here will be lost when autosplit is run again.
|
---|
3 | # See AutoSplit.pm.
|
---|
4 | package Image::Size;
|
---|
5 |
|
---|
6 | #line 848 "lib/Image/Size.pm (autosplit into blib/lib/auto/Image/Size/pngsize.al)"
|
---|
7 | # pngsize : gets the width & height (in pixels) of a png file
|
---|
8 | # cor this program is on the cutting edge of technology! (pity it's blunt!)
|
---|
9 | #
|
---|
10 | # Re-written and tested by [email protected]
|
---|
11 | sub pngsize
|
---|
12 | {
|
---|
13 | my $stream = shift;
|
---|
14 |
|
---|
15 | my ($x, $y, $id) = (undef, undef, "could not determine PNG size");
|
---|
16 | my ($offset, $length);
|
---|
17 |
|
---|
18 | # Offset to first Chunk Type code = 8-byte ident + 4-byte chunk length + 1
|
---|
19 | $offset = 12; $length = 4;
|
---|
20 | if (&$read_in($stream, $length, $offset) eq 'IHDR')
|
---|
21 | {
|
---|
22 | # IHDR = Image Header
|
---|
23 | $length = 8;
|
---|
24 | ($x, $y) = unpack("NN", &$read_in($stream, $length));
|
---|
25 | $id = 'PNG';
|
---|
26 | }
|
---|
27 |
|
---|
28 | ($x, $y, $id);
|
---|
29 | }
|
---|
30 |
|
---|
31 | # end of Image::Size::pngsize
|
---|
32 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.