.
"
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.
"
!
version
"
$Header: /cvs/stx/stx/libview2/JPEGReader.st,v 1.10 1995-08-30 17:53:59 claus Exp $
"
!
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.
"
! !
!JPEGReader class methodsFor:'initialization'!
initialize
Image fileFormats at:'.jpg' put:self.
Image fileFormats at:'.jpeg' put:self.
Image fileFormats at:'.JPG' put:self.
! !
!JPEGReader class 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).
'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'
"
! !