"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
ImageReader subclass:#JPEGReader
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Graphics-Images support'
!
!JPEGReader class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
Reader for JPEG images.
This is a quick&dirty hack, using the PD djpeg tool to convert
the JPG image to GIF first, then reads the GIF image using GIFReader.
Of course, this is slower than it should be. If lots of JPG reading
is done, this class should be rewritten, to directly call the (C) JPG
decoding functions.
Only reading of files is supported.
CAVEAT:
you have to have the djpeg program installed.
[See also:]
Image Form Icon
BlitImageReader FaceReader GIFReader PBMReader PCXReader
ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader
XBMReader XPMReader XWDReader
"
! !
!JPEGReader class methodsFor:'initialization'!
initialize
"install myself in the Image classes fileFormat table
for the `.jpg', '.jpeg' and '.JPG' extensions."
Image fileFormats at:'.jpg' put:self.
Image fileFormats at:'.jpeg' put:self.
Image fileFormats at:'.JPG' put:self.
"Modified: 23.4.1996 / 12:28:03 / cg"
! !
!JPEGReader class methodsFor:'reading from file'!
fromFile:aFileName
"read a jpg image from a file.
Make it the easy way: let djpeg convert it to gif,
then let GIFReader read the file."
|tempFileName reader|
tempFileName := '/tmp/img' , (OperatingSystem getProcessId printString).
'JPEGREADER: converting to gif ..' errorPrintNL.
(OperatingSystem executeCommand:'djpeg -gif ' , aFileName , ' > ' , tempFileName)
ifTrue:[
reader := GIFReader fromFile:tempFileName.
OperatingSystem executeCommand:'rm ' , tempFileName.
^ reader
].
'JPEGREADER: conversion failed ..' errorPrintNL.
self warn:'cannot execute jpeg converter: djpeg'.
^ nil
"
JPEGReader fromFile:'bitmaps/testimg.jpg'
"
"Modified: 23.4.1996 / 12:30:12 / cg"
! !
!JPEGReader class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.15 1996-04-29 08:46:18 cg Exp $'
! !
JPEGReader initialize!