Bug 279 : loadImage(URL) broken on windows
Last modified: 2006-03-19 21:11




Status:
RESOLVED
Resolution:
DUPLICATE of bug 305
Priority:
P2
Severity:
normal

 

Reporter:
splat
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2006-01-25 10:50
Even with images residing in the same directory (with relative OR absolute URLs)
loadImage() is not able to load images. (When running as applet).

I thought I remembered this as a feature. Was I dreaming?
_________________-
PImage b;

void setup() {
size(500,500);
b = loadMyImage("http://wheretheAppletresides.com/viewtest/test.jpg");
}
void draw() {
image(b, 0, 0);
}
_________________

---error:
Error while running applet.
java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster
(Unknown Source)
at java.awt.image.BufferedImage.<init>(Unknown Source)
at processing.core.PGraphics2$ImageCache.<init>(PGraphics2.java:558)
at processing.core.PGraphics2.imageImpl(PGraphics2.java:520)
at processing.core.PGraphics.image(PGraphics.java:1676)
at processing.core.PApplet.image(PApplet.java:6173)
at sketch_060124a.draw(sketch_060124a.java:10)
at processing.core.PApplet.display(PApplet.java:1229)
at processing.core.PGraphics.requestDisplay(PGraphics.java:520)
at processing.core.PApplet.run(PApplet.java:1046)
at java.lang.Thread.run(Unknown Source)
Additional Comment #1 From fry 2006-01-25 13:18
just tested this with an image and it works fine for me. perhaps the image isn't properly
formatted in some way?
Additional Comment #2 From fry 2006-02-06 15:21
confirmed to work fine on macosx, but causes the bug on windows only (yay! cross-platform
java!) not sure what linux does with it yet.
Additional Comment #3 From splat 2006-02-06 15:27
I've been playing around with it... it seems like it might have something to do with
JPEG compression. I have it working with some images and not others. (Its
surprisingly inconsistent,.. if I figure out more I'll let you know). Incedentally I'm
hoping to try to put together either a JPEG save frame, or a TIF loader. (processing
really needs to be able to load its own images). If I can do it I suspect it will be
sloppy, but I'll try to share. Cheers.
Additional Comment #4 From toastie 2006-02-07 00:14

So it seems that it's getting the size of -1 from the AWT Image in the
PImage constructor. I played around with it a bit and it seems that even
after waitForAll() doesnt fail out, the size of the Image is -1,-1 when it
gets passed to the PImage, hence the error. I cant figure out if it just
doesnt load it or if needs to wait for it to initialize its size correctly.
Additional Comment #5 From fry 2006-02-07 06:32
right, the -1 is just a symptom that the image didn't load. just a bit frustrating since it doesn't
seem to be flagging any sort of errors, though perhaps that's getting sent to the mediatracker
and it just needs to be queried.
Additional Comment #6 From toastie 2006-02-07 07:41
I think it's something with the stream in loadBytes.. if I load it with
getImage(URL url), it works no problem.
Additional Comment #7 From fry 2006-02-07 08:28
hm, so i wonder if loadBytes() could actually be somehow broken for URLs (this would be more
positive than there just being a bug in sun's Toolkit function on windows that creates an image
from a byte array, because we'd have to write code to get around it).
Additional Comment #8 From fry 2006-03-14 20:05
this may be related to bug #305.
Additional Comment #9 From fry 2006-03-19 21:11


*** This bug has been marked as a duplicate of 305 ***