| 1 |
%% |
| 2 |
%% This is file `bmpsize.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% bmpsize.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Project: bmpsize |
| 12 |
%% Version: 2019/12/29 v1.8 |
| 13 |
%% |
| 14 |
%% Copyright (C) |
| 15 |
%% 2006-2009 Heiko Oberdiek |
| 16 |
%% 2016-2019 Oberdiek Package Support Group |
| 17 |
%% |
| 18 |
%% This work may be distributed and/or modified under the |
| 19 |
%% conditions of the LaTeX Project Public License, either |
| 20 |
%% version 1.3c of this license or (at your option) any later |
| 21 |
%% version. This version of this license is in |
| 22 |
%% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 23 |
%% and the latest version of this license is in |
| 24 |
%% https://www.latex-project.org/lppl.txt |
| 25 |
%% and version 1.3 or later is part of all distributions of |
| 26 |
%% LaTeX version 2005/12/01 or later. |
| 27 |
%% |
| 28 |
%% This work has the LPPL maintenance status "maintained". |
| 29 |
%% |
| 30 |
%% The Current Maintainers of this work are |
| 31 |
%% Heiko Oberdiek and the Oberdiek Package Support Group |
| 32 |
%% https://github.com/ho-tex/oberdiek/issues |
| 33 |
%% |
| 34 |
%% |
| 35 |
%% This work consists of the main source file bmpsize.dtx |
| 36 |
%% and the derived files |
| 37 |
%% bmpsize.sty, bmpsize.pdf, bmpsize.ins, bmpsize.drv, |
| 38 |
%% bmpsize-base.sty, bmpsize-test.tex, bmpsize-dvips.def, |
| 39 |
%% bmpsize-dvipdfm.def, bmpsize-dvipdfmx.def. |
| 40 |
%% |
| 41 |
\ProvidesPackage{bmpsize}% |
| 42 |
[2019/12/29 v1.8 Extract size/resolution from bitmap files (HO)]% |
| 43 |
\RequirePackage{iftex} |
| 44 |
\ifpdf |
| 45 |
\PackageInfo{bmpsize}{Superseded by pdfTeX in PDF mode}% |
| 46 |
\expandafter\endinput |
| 47 |
\fi |
| 48 |
\RequirePackage{pdftexcmds}[2007/11/11] |
| 49 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 50 |
\expandafter\ifx\csname pdf@filedump\endcsname\relax |
| 51 |
\PackageError{bmpsize}{% |
| 52 |
You need pdfTeX 1.30.0 or newer% |
| 53 |
}{Package loading is aborted.}% |
| 54 |
\expandafter\endinput |
| 55 |
\fi |
| 56 |
|
| 57 |
\RequirePackage{infwarerr}[2007/09/09] |
| 58 |
\RequirePackage{graphics} |
| 59 |
\RequirePackage{keyval}\relax |
| 60 |
\expandafter\ifx\csname KV@errx\endcsname\relax |
| 61 |
\def\KV@errx#1{% |
| 62 |
\@PackageError{keyval}{#1}\@ehc |
| 63 |
}% |
| 64 |
\fi |
| 65 |
\expandafter\ifx\csname KV@err\endcsname\relax |
| 66 |
\let\KV@err\KV@errx |
| 67 |
\fi |
| 68 |
\RequirePackage{bmpsize-base} |
| 69 |
|
| 70 |
\InputIfFileExists{bmpsize-\Gin@driver}{}{} |
| 71 |
|
| 72 |
\define@key{Gin}{bmpsizefast}[true]{% |
| 73 |
\expandafter\ifx\csname if#1\expandafter\endcsname\csname iftrue\endcsname |
| 74 |
\@bmpsize@fasttrue |
| 75 |
\else |
| 76 |
\@bmpsize@fastfalse |
| 77 |
\fi |
| 78 |
} |
| 79 |
\define@key{Gin}{resolutionunit}{% |
| 80 |
\def\bmpsize@unit@default{#1}% |
| 81 |
} |
| 82 |
\begingroup |
| 83 |
\def\x#1{\endgroup |
| 84 |
\define@key{Gin}{resolution}{% |
| 85 |
\@bmpsize@read@resolution\@bmpsize@user@resolutiontrue##1#1#1\@nil |
| 86 |
}% |
| 87 |
\define@key{Gin}{defaultresolution}{% |
| 88 |
\@bmpsize@read@resolution\@bmpsize@user@resolutionfalse##1#1#1\@nil |
| 89 |
}% |
| 90 |
}% |
| 91 |
\x{ } |
| 92 |
\def\@bmpsize@read@resolution#1#2 #3 #4\@nil{% |
| 93 |
\ifcase 0\ifx\\#2\\1\fi |
| 94 |
\ifnum\pdf@strcmp{#2}{\Gin@exclamation}=\z@ |
| 95 |
\ifx\\#3\\1\fi |
| 96 |
\ifnum\pdf@strcmp{#3}{\Gin@exclamation}=\z@ |
| 97 |
1% |
| 98 |
\fi |
| 99 |
\fi |
| 100 |
\ifcase\pdf@strcmp{#2}{\Gin@exclamation}\relax |
| 101 |
\let\bmpsize@pixelx@default\Gin@exclamation |
| 102 |
\else |
| 103 |
\edef\bmpsize@pixelx@default{#2}% |
| 104 |
\fi |
| 105 |
\ifcase\pdf@strcmp{#3}{\Gin@exclamation}\relax |
| 106 |
\let\bmpsize@pixely@default\Gin@exclamation |
| 107 |
\else |
| 108 |
\ifx\\#3\\% |
| 109 |
\let\bmpsize@pixely@default\bmpsize@pixelx@default |
| 110 |
\else |
| 111 |
\edef\bmpsize@pixely@default{#3}% |
| 112 |
\fi |
| 113 |
\fi |
| 114 |
#1% |
| 115 |
\else |
| 116 |
\PackageError{bmpsize}{% |
| 117 |
Wrong syntax for key (default)resolution% |
| 118 |
}{% |
| 119 |
See package documentation for correct syntax.% |
| 120 |
}% |
| 121 |
\fi |
| 122 |
} |
| 123 |
\newcommand*{\bmpsizesetup}{\setkeys{Gin}} |
| 124 |
|
| 125 |
\let\@bmpsize@org@setfile\Gin@setfile |
| 126 |
\def\Gin@setfile#1#2#3{% |
| 127 |
\ifcase\pdf@strcmp{#1}{bmp}\relax |
| 128 |
\expandafter\@firstofone |
| 129 |
\else |
| 130 |
\expandafter\@gobble |
| 131 |
\fi |
| 132 |
{% |
| 133 |
\bmpsize@okfalse |
| 134 |
\edef\bmpsize@ext{\ifx\Gin@ext\relax\Gin@eext\else\Gin@ext\fi}% |
| 135 |
\edef\bmpsize@file{\Gin@base\bmpsize@ext}% |
| 136 |
\edef\@bmpsize@temp{\bmpsize@ext}% |
| 137 |
\@ifundefined{bmpsize@read@\@bmpsize@temp}{% |
| 138 |
\@ifundefined{bmpsize@map@\@bmpsize@temp}{}{% |
| 139 |
\expandafter\let\expandafter\@bmpsize@temp |
| 140 |
\csname bmpsize@map@\@bmpsize@temp\endcsname |
| 141 |
}% |
| 142 |
}{}% |
| 143 |
\@ifundefined{bmpsize@read@\@bmpsize@temp}{% |
| 144 |
}{% |
| 145 |
\csname bmpsize@read@\@bmpsize@temp\endcsname\bmpsize@file |
| 146 |
}% |
| 147 |
\ifbmpsize@ok |
| 148 |
\else |
| 149 |
\@for\@bmpsize@temp:=\bmpsize@types\do{% |
| 150 |
\ifbmpsize@ok |
| 151 |
\else |
| 152 |
\csname bmpsize@read@\@bmpsize@temp\endcsname\bmpsize@file |
| 153 |
\fi |
| 154 |
}% |
| 155 |
\fi |
| 156 |
\ifbmpsize@ok |
| 157 |
\ifGin@bbox |
| 158 |
\@ifundefined{Gin@vllx}{% |
| 159 |
\@PackageWarning{bmpsize}{Explicit bounding box is ignored}% |
| 160 |
}{% |
| 161 |
\ifx\Gin@viewport@code\relax |
| 162 |
\def\Gin@ollx{0}% |
| 163 |
\let\Gin@olly\Gin@ollx |
| 164 |
\let\Gin@ourx\bmpsize@width |
| 165 |
\let\Gin@oury\bmpsize@height |
| 166 |
\let\Gin@vllx\Gin@llx |
| 167 |
\let\Gin@vlly\Gin@lly |
| 168 |
\let\Gin@vurx\Gin@urx |
| 169 |
\let\Gin@vury\Gin@ury |
| 170 |
\let\Gin@viewport@code\Gin@viewport |
| 171 |
\@PackageWarning{bmpsize}{% |
| 172 |
Explicit bounding box replaced by\MessageBreak |
| 173 |
viewport setting% |
| 174 |
}% |
| 175 |
\else |
| 176 |
\@PackageWarning{bmpsize}{Explicit bounding box is ignored}% |
| 177 |
\fi |
| 178 |
}% |
| 179 |
\fi |
| 180 |
\def\Gin@llx{0}% |
| 181 |
\def\Gin@lly{0}% |
| 182 |
\let\Gin@urx\bmpsize@width |
| 183 |
\let\Gin@ury\bmpsize@height |
| 184 |
\Gin@bboxtrue |
| 185 |
\else |
| 186 |
\PackageInfo{bmpsize}{Unknown image type of \bmpsize@file}% |
| 187 |
\fi |
| 188 |
}% |
| 189 |
\@bmpsize@org@setfile{#1}{#2}{#3}% |
| 190 |
} |
| 191 |
\newcommand*{\bmpsize@ext@type}[1]{% |
| 192 |
\@namedef{bmpsize@map@#1}% |
| 193 |
} |
| 194 |
\bmpsize@ext@type{.jpg}{jpg} |
| 195 |
\bmpsize@ext@type{.jpe}{jpg} |
| 196 |
\bmpsize@ext@type{.jfif}{jpg} |
| 197 |
\bmpsize@ext@type{.jpeg}{jpg} |
| 198 |
\bmpsize@ext@type{.tif}{tiff} |
| 199 |
\bmpsize@ext@type{.tiff}{tiff} |
| 200 |
\bmpsize@ext@type{.pcx}{pcx} |
| 201 |
\bmpsize@ext@type{.msp}{msp} |
| 202 |
\bmpsize@ext@type{.bmp}{bmp} |
| 203 |
\bmpsize@ext@type{.png}{png} |
| 204 |
\bmpsize@ext@type{.pnm}{pnm} |
| 205 |
\bmpsize@ext@type{.pbm}{pnm} |
| 206 |
\bmpsize@ext@type{.pgm}{pnm} |
| 207 |
\bmpsize@ext@type{.ppm}{pnm} |
| 208 |
\bmpsize@ext@type{.pam}{pam} |
| 209 |
\bmpsize@ext@type{.xpm}{xpm} |
| 210 |
\bmpsize@ext@type{.gif}{gif} |
| 211 |
\bmpsize@ext@type{.tga}{tga} |
| 212 |
\bmpsize@ext@type{.sgi}{sgi} |
| 213 |
\endinput |
| 214 |
%% |
| 215 |
%% End of file `bmpsize.sty'. |