I've discovered you can import java (not javascript) libraries into dashboard and use them.
Im using this to read colors from swatch pngs for sports.
This seems off-the-books, so I thought I'd ask if there's any known pitfalls.
Here's an example script:
// Import the necessary Java classes
var BufferedImage = java.awt.image.BufferedImage;
var File = java.io.File;
var ImageIO = javax.imageio.ImageIO;
ogscript.debug(new java.io.File(".").getAbsolutePath());
try {
// Load the PNG image
var file = new File("C:/test.png"); // Replace with your image path
var image = ImageIO.read(file);
// Get image width and height
var width = image.getWidth();
var height = image.getHeight();
// Loop through each pixel
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
// Get RGB value of the pixel
var pixel = image.getRGB(x, y);
// Extract ARGB components
var alpha = (pixel >> 24) & 0xff;
var red = (pixel >> 16) & 0xff;
var green = (pixel >> 8) & 0xff;
var blue = pixel & 0xff;
// Print pixel coordinates and color values
ogscript.debug("Pixel at (" + x + "," + y + "): " +
"Alpha: " + alpha + ", Red: " + red +
", Green: " + green + ", Blue: " + blue);
}
}
} catch (e) {
ogscript.debug(e);
}
ogscript.reload ("test");
------------------------------
David Levy
Lead Real Time Graphics Developer
ESPN
------------------------------