Having some annoying issues with loading images into a BufferedImage (image in the example) with the use of ImageIO.read, due to there being spaces in the Image name;
image = ImageIO.read(new File(getClass().getResource("/Pictures/H ello.jpg").getPath()));
If I rename the url(?) “/Pictures/H ello.jpg” to “/Pictures/Hello.jpg” and the source image to Hello.jpg it works just fine.
I’ve tried replacing the spaces with %20 as found on other questions and also a replace char of ‘ ‘ to ‘+’. So what am I doing wrong? Would encoding solve my problem and how would I do that?
Thanks,
The following possibly works.