"
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-Support'
!
JPEGReader comment:'
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
$Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.6 1994-10-10 02:32:33 claus Exp $
'!
!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.
"
!
version
"
$Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.6 1994-10-10 02:32:33 claus Exp $
"
!
documentation
"
Reader for JPEG images.
uses PD djpeg tool to convert JPG image to gif first,
then read GIF image using GIFReader.
"
! !
!JPEGReader class methodsFor:'initialization'!
initialize
Image fileFormats at:'.jpg' put:self.
Image fileFormats at:'.jpeg' put:self.
Image fileFormats at:'.JPG' put:self.
! !
!JPEGReader methodsFor:'reading from file'!
fromFile:aFileName
"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).
Transcript showCr:'converting to gif ..'.
(OperatingSystem executeCommand:'djpeg -gif ' , aFileName , ' > ' , tempFileName)
ifTrue:[
reader := GIFReader fromFile:tempFileName.
OperatingSystem executeCommand:'rm ' , tempFileName.
^ reader
].
Transcript showCr:'conversion failed ..'.
self warn:'cannot execute jpeg converter: djpeg'.
^ nil
"JPEGReader fromFile:'bitmaps/testimg.jpg'"
! !