We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › loadImage(URL)?
Page Index Toggle Pages: 1
loadImage(URL)??? (Read 901 times)
loadImage(URL)???
Jan 25th, 2006, 9:23am
 
I feel like this is a really basic question, but I've spent way too long trying to straighten it out. Does anyone know how to get an applet (outside of the editor) to load an image from an absolute URL? (With the applet residing on the same server... and even in the same directory). I thought I remembered doing this but I cant find an example now and I've tried several servers and several files.


This basic test:

PImage b;

void setup() {
 size(500,500);
 b = loadImage("http://mysite.com/stuff/viewtest/test.jpg");
  image(b, 0, 0);
}

keeps spitting out:
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)


Is this a feature that I dreampt up? Possibly a bug in the last few distribs (I tried several).

Maybe the loadImage mediaTracker is not executing properly, or the applet is looking for the URL in the jar? HELP!!!
Re: loadImage(URL)???
Reply #1 - Jan 25th, 2006, 10:19pm
 
just tried it, works fine for me. is there something else about your setup that could be causing problems?
http://dev.processing.org/bugs/show_bug.cgi?id=279
Re: loadImage(URL)???
Reply #2 - Feb 6th, 2006, 5:44pm
 
i can second that, seems to not be working for me.
Re: loadImage(URL)???
Reply #3 - Feb 6th, 2006, 10:56pm
 
can someone post a sketch that causes the problem?
Re: loadImage(URL)???
Reply #4 - Feb 6th, 2006, 11:18pm
 
its basically just loadImage() from a url that doesnt work. Even in the simplest testcase, it works when run on the desktop but as an applet, it seems to not work. I made a barebones example. I tried doing it directly with an awt Image as well and it still didnt work so im guessing its something to do with that:

http://www.ivansafrin.com/processing/doesntwork/

PImage anImage;
void setup()
{
 size(200, 200);
 stroke(255);  
 anImage = loadImage("http://www.ivansafrin.com/marco.jpg");
}
void draw()
{
 background(0);
 image(anImage, 0,0);
}


Re: loadImage(URL)???
Reply #5 - Feb 7th, 2006, 12:22am
 
k, thanks for posting. the problem is that it's only broken on windows. the mac loads it just fine. since it's in the bugs db any followup will happen there, so i'm closing the thread here.
http://dev.processing.org/bugs/show_bug.cgi?id=279
Page Index Toggle Pages: 1