Oops, disregard the previous message. I figured out that the source code
was looking for jpeg files with the .jpg extention when I had them saved
as .jpeg. As far the inconsitent result from calling getWidth() on the
Image, I simply forgot to use a MediaTracker to make sure the image was
loaded.
Sorry,
-chi
-----Original Message-----
From: Tran, Chi [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 05, 1999 1:28 PM
To: '[EMAIL PROTECTED]'
Subject: [java2d] Can't get ImageOps demo to work
Hi,
I downloaded the ImageOps demo from the Java 2D tutorial page at:
http://java.sun.com/docs/books/tutorial/2d/images/example-1dot2/ImageOps.jav
a
I also download the associated images "bld.jpg" and "boat.gif" and
placed them in the appropriate directoy as indicated by the code.
When I run it I get the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Width (-1)
and height (0) must be > 0
at java.awt.image.SampleModel.<init>(SampleModel.java:93)
at java.awt.image.SinglePixelPackedSampleModel.<init>(Compiled Code)
at java.awt.image.Raster.createPackedRaster(Raster.java:598)
at java.awt.image.Raster.createPackedRaster(Raster.java:412)
at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorMo
del.java:637)
at java.awt.image.BufferedImage.<init>(Compiled Code)
at ImageOps.init(Compiled Code)
at ImageOps.main(ImageOps.java:114)
I have also tried to write simple test cases to load images and determine
their sizes by calling Image.getWidth(ImageObserver). I get inconsitant
results. Sometimes I get -1 as a return value and sometimes I get the
correct size.
I am running the latest version of JDK1.2 on a PII/350 PC running
WinNT4.0 (service pack 4).
Does anyone have any hints?
Thanks,
-chi
Chi Tran
Century Computing Division of AppNet, Inc.
8101 Sandy Spring Rd.
Laurel, MD 20707
email: [EMAIL PROTECTED]
phone: (301) 953-3330
fax: (301) 953-2368
http://www.centurycomputing.com
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/