Rudolph123 Posted May 7 Share Posted May 7 I can't seem to load custom images to OSBot for the Logo and also for my paint. Currently I have my paint set up but I'd like to change my background to something a little nicer. I can't seem to figure out how to load the images. I've tried loading the png following this guide however I'm not exactly sure which library to import that supports main in. background = ImageIO.read(Main.class.getResourceAsStream("/resources/background.png")); For my IDE only 4 populate, 1 crashes the script. and the other 3 permissions are blocked. I've tried loading it from a url using imgur, and imgbb with no luck. Can anyone help me understand how these images need to be formatted in the directory/ loaded into the script to be drawn on the screen, and how I might be able to load an image as the bot logo. Any information would be greatly apricated, thanks for your time. Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted May 7 Share Posted May 7 3 hours ago, Rudolph123 said: I can't seem to load custom images to OSBot for the Logo and also for my paint. Currently I have my paint set up but I'd like to change my background to something a little nicer. I can't seem to figure out how to load the images. I've tried loading the png following this guide however I'm not exactly sure which library to import that supports main in. background = ImageIO.read(Main.class.getResourceAsStream("/resources/background.png")); For my IDE only 4 populate, 1 crashes the script. and the other 3 permissions are blocked. I've tried loading it from a url using imgur, and imgbb with no luck. Can anyone help me understand how these images need to be formatted in the directory/ loaded into the script to be drawn on the screen, and how I might be able to load an image as the bot logo. Any information would be greatly apricated, thanks for your time. Would be easier to see what's going on if you shared some of the code in your loading and drawing methods ^^ Imgur won't work, it's pretyt much broken for some reason. I would suggest fetching them from an url, ibb for example (https://nl.imgbb.com/) Best way is to save it in the OSBot/data folder and try to see if it's there else fetch and save it there to fetch from a url: public static BufferedImage getImage(Script script, String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { script.log("Failed to load image with url: " + url); e.printStackTrace(); } return null; } Just do this in your onStart or something and save the image so it can be used by the onPaint 1 Quote Link to comment Share on other sites More sharing options...
Rudolph123 Posted May 7 Author Share Posted May 7 9 hours ago, Khaleesi said: Would be easier to see what's going on if you shared some of the code in your loading and drawing methods ^^ Imgur won't work, it's pretyt much broken for some reason. I would suggest fetching them from an url, ibb for example (https://nl.imgbb.com/) Best way is to save it in the OSBot/data folder and try to see if it's there else fetch and save it there to fetch from a url: public static BufferedImage getImage(Script script, String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { script.log("Failed to load image with url: " + url); e.printStackTrace(); } return null; } Just do this in your onStart or something and save the image so it can be used by the onPaint Thanks a lot, it is now up and running! I went into the data folder and saved it there. However when I submit the bot to the client so people can download it. The image is only saved locally when I manually place the image in the data folder, right? Would I need to write a class to create the dir and then save the images that are located in my src or resources folder? Then call that method onStart? I'm unsure how OSBot typically wants those files to shipped as well as saved and loaded for users. Quote Link to comment Share on other sites More sharing options...
Czar Posted May 7 Share Posted May 7 2 hours ago, Rudolph123 said: Thanks a lot, it is now up and running! I went into the data folder and saved it there. However when I submit the bot to the client so people can download it. The image is only saved locally when I manually place the image in the data folder, right? Would I need to write a class to create the dir and then save the images that are located in my src or resources folder? Then call that method onStart? I'm unsure how OSBot typically wants those files to shipped as well as saved and loaded for users. If you are going to export to jar then the images must be inside the project folder, I put mine in a directory called /resources/ and then you can choose to pack these images inside the jar depending on which IDE you use 1 Quote Link to comment Share on other sites More sharing options...