summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib/viewjpeg.ps
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2013-02-18 22:54:24 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2013-02-18 22:54:24 +0000
commit152319ccddf48a345b38cc725bf839467fd9d57d (patch)
treeccf35a4c175f9b536ac4f32207690e8e355c0526 /Master/tlpkg/tlgs/lib/viewjpeg.ps
parent8bf3f3c636bf1dee1cb1b3cfcdaa951c3879c937 (diff)
tlgs: update gs-9.05 -> gs-9.07
git-svn-id: svn://tug.org/texlive/trunk@29151 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/lib/viewjpeg.ps')
-rw-r--r--Master/tlpkg/tlgs/lib/viewjpeg.ps18
1 files changed, 16 insertions, 2 deletions
diff --git a/Master/tlpkg/tlgs/lib/viewjpeg.ps b/Master/tlpkg/tlgs/lib/viewjpeg.ps
index 7de234015eb..354bfd72543 100644
--- a/Master/tlpkg/tlgs/lib/viewjpeg.ps
+++ b/Master/tlpkg/tlgs/lib/viewjpeg.ps
@@ -13,7 +13,6 @@
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
-% $Id$
% View JPEG files with Ghostscript
%
% This PostScript code relies on level 2 features.
@@ -30,7 +29,6 @@
% pstack exec quit | voice +49/89/29160728
% ------------------------------+ tm@muc.de http://www.muc.de/~tm/
%
-% $Id$
% Updated by L. Peter Deutsch 20-May-1997:
% move the usage example to the beginning
% Updates by Tom Lane 6-Sep-1995
@@ -157,3 +155,19 @@ end % JPEGdict
saved end restore
} bind def
+
+% This lets you do stuff on the command line like:
+% gs -sDEVICE=pdfwrite -o stuff%03d.pdf viewjpeg.ps -c "(image.jpg) << /PageSize 2 index viewJPEGgetsize 2 array astore >> setpagedevice viewJPEG"
+% so the output size matches the original image.
+/viewJPEGgetsize { % <file|string> ==> width height
+ save
+ JPEGdict begin
+ /saved exch def
+ /scratch 1 string def
+ dup type /stringtype eq { (r) file } if
+ /F exch def
+ readJPEGmarkers begin
+ F 0 setfileposition % reset file pointer
+ width height
+ saved end restore
+} bind def