there is a class
public class Portret implements Serializable{ private Image img; public Image getImg(){ if(img!=null)return img; else img = new Image("..."); return img; } public void setImg(Image im){ img=im; } } it needs to be saved to a file, but the Image class (JavaFX) does not implement the Serializable interface, so when you try to save it to a file, you get the error "NotSerializableException" due to the presence of the Image img field. I decided to declare the field as "transient" but I need to save the image in the class instance itself in some form. Tell me how you can circumvent this limitation, or what can you convert an image (with a view to its subsequent restoration) within an instance of a class so that Java allows you to write an object to a file?