Rob Jenkins (robj++at++quid.csd.sgi.com)
Thu, 15 Jan 1998 08:29:51 -0800
imgworks will work fine although I'd advise using imgview these days instead of
imgworks - imgview is build with the latest IL stuff, imgworks is still built
with old IL libs.
The IL has a great scripting language 'imgtcl' that you can use to make a
script that you can then use to handle multiple images and have fine control
over the zoom factor, resampling method etc. Assuming you have recent imgtools
installed ( you can get them from the SGI web if not ) then under
/usr/share/src/imgtcl are some samples, I've attached one that you could change
to zoom/shrink files to the size you want. I also attached a more sophisticated
script that will create mipmaps in case it's useful to you.
Cheers
Rob
-- ________________________________________________________________ Rob Jenkins mailto:robj++at++sgi.com Silicon Graphics, Mtn View, California, USA
#!/usr/sbin/imgtcl # # This script can be used to create a 400x256 size image from # an arbitrarily sized input image. # The output file format is inferred from the output filename. #
# check arguments
if {$argc != 2} { puts "Usage: imgbg <input-file> <output-file>" exit 1 }
# open the input image
ilFileImgOpen infile [lindex $argv 0]
# compute the zoom factor needed to fill a 400x256 output
new iflSize size {1} infile getSize size set xzoom [expr 400./[$size 0 x]] set yzoom [expr 256./[$size 0 y]] set zoomfactor [expr $xzoom > $yzoom? $xzoom : $yzoom]
# create a zoomed version of the image 400x256, use bi-cubic resampling
ilRotZoomImg zoom $infile 0 $zoomfactor $zoomfactor ilBiCubic zoom setXYsize 400 256
# save it in the ouput file
ilFileImgCreate outfile [lindex $argv 1] zoom ilSetDither ilFSDither outfile copy zoom outfile delete
From - Thu Feb 20 10:35:07 1997 Path: news.neu.sgi.com!news.corp.sgi.com!fido.asd.sgi.com!giraffe.asd.sgi.com!walker From: Christopher Walker <walker++at++giraffe.asd.sgi.com> Newsgroups: sgi.engr.il Subject: Re: Scaling an image Date: 14 Feb 1997 09:53:23 -0800 Organization: Silicon Graphics Lines: 109 Sender: root++at++fido.asd.sgi.com Approved: mailnews++at++fido.asd.sgi.com Distribution: sgi Message-ID: <5e28qj$ivn++at++fido.asd.sgi.com> References: <199702141730.JAA25717++at++thanos.corp.sgi.com> NNTP-Posting-Host: fido.asd.sgi.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------20433F781E4D" This is a multi-part message in MIME format.
charset=us-ascii Content-Transfer-Encoding: 7bit Michael O'Brien wrote: > > Hola Brad~ > > I have about 30 images in SGI format that I would like to convert and scale > to gif format. > > Is there a way to scale images in a batch method??? Does scale mean change brightness or change size? Not that it matters, you can do either and much more with the tool below.. > In reading the man pages for imgcopy, it doesn't appear so. > If running Irix 6.2 or later, get IL 3.1.1 and imgtools 3.1.1 and use imgtcl to do the job (a TCL based interpreter for IL that lets you write useful scripts to do these sorts of batch jobs, or just to play around interactively. I've attached a a sample script to get the flavor of the sort of things you can do. -- Chris Walker (walker++at++asd.sgi.com) --------------20433F781E4D Content-Type: text/plain; charset=us-ascii; name="imgrset" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="imgrset" #!/usr/sbin/imgtcl # # This script can be used to create a set of reduced-resolution versions # of a source image (also called mipmaps). If the image is called say: # # foo.tif # # then this script will create a set of progressively smaller images: # # foo.0.tif (symlink to original image) # foo.1.tif (reduced by 2x in width and height) # foo.2.tif (reduced by 4x in width and height) # ... # # The smallest image created will be larger than 128 in width or height. # # check arguments if {$argc != 1} { puts "Usage: imgrset <input-file>" exit 1 } # pick apart the file name into its component pieces set name [lindex $argv 0] set root [file rootname $name] set ext [file extension $name] # open input image ilFileImgOpen in $name if {[in.getStatus] != "ilOKAY"} { puts "Couldn't open $name" exit 1 } # make a symlink for "r0" if {![file exists $root.0$ext]} { exec ln -s [file tail $name] $root.0$ext } # minify by .5 ilRotZoomImg zoom in 0 .5 .5 ilBiLinear zoom setPageSizeXY 128 128 # create smaller and smaller versions, using the output of the last stage # as the input to the next, until we would be smaller then 128 in both # dimensions set i 1 while {[zoom getXsize] > 128 || [zoom getYsize] > 128} { ilFileImgCreate out.$i $root.$i$ext zoom puts "Creating: $root.$i$ext ([zoom getXsize]x[zoom getYsize])" out.$i copy zoom out.$i flush zoom setInput out.$i incr i } # close all the output files to make sure they get flushed while {$i > 1} { set i [expr $i - 1] out.$i delete } --------------20433F781E4D--
.+-!Lm,'(r薈2~J"{")zg٢-)ߢ~zު笶"
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:34 PDT