title: How to serialize an object that includes BufferedImages
body: <p>I'm trying to create a simple image editing program in java. I made an <code>ImageCanvas</code> object that has all the information about the image that is being edited (some basic properties, list of effects being applied, a list of <code>BufferedImage</code> layers, etc.) and I wanted a simple way to save it to disk so it could be opened again later. </p>
  
  <p>I figured that using Java's defualt <code>Serializable</code> interface might be exactly what I was looking for and I could just write the entire object to file and read it back into memory again at a later time. However, <code>ImageCanvas</code> includes an <code>ArrayList&lt;BufferedImage&gt;</code>, and <code>BufferedImage</code>'s are not serializable (everything else is).</p>
  
  <p>I know it is possible to override the <code>writeObject()</code> and <code>readObject()</code> methods, but I have never done so and I was wondering if there is any easy way to have Java serialize everything else and have some custom way to read/write the <code>BufferedImage</code>'s to disk? Or is there some other way to easily write the entire <code>ImageCanvas</code> object to disk that I'm overlooking? Eventually I might implement my own custom image file type, but for right now I wanted a quick and easy way to save files temporarily while I am testing (the <code>ImageCanvas</code> class will change a lot, so I didn't want to have to keep updating my custom file type before I have it finalized).</p>