I'm get a
File file = new file(path);
AdvancedBufferedImage image = (AdvancedBufferedImage) ImageIO.read(file);
Downcasting like this is not allowed.
The preferred solution would be to create a constructor of AdvancedBufferedImage, taking a BufferedImage as parameter. With that you could do the following.
File file = new file(path); AdvancedBufferedImage image = new AdvancedBufferedImage(ImageIO.read(file));
Here the constructor of AdvancedBufferedImage can decide how to properly convert a BufferedImage in an advanced one..