@Override
public JSONObject toJSONObject()
{
JSONObject attr = new JSONObject(getAttributes());
PictureSerializationMode mode = getSerializationMode();
if (mode == PictureSerializationMode.DATA_URL)
{
// TODO support different image formats
attr.put("url", new JSONString(toDataURL(null)));