code: @Override
      public JSONObject toJSONObject()
      {
          final JSONObject attr = new JSONObject(getAttributes().getJSO());
  
          if (getImageSerializationMode() == ImageSerializationMode.DATA_URL)
          {
              String url = getImageProxy().getImageElementURL();
  
              if (null == url)
              {
                  url = getAttributes().getURL();
              }
              if (url.startsWith("data:"))
              {
                  attr.put("url", new JSONString(url));
              }
              else
              {
                  attr.put("url", new JSONString(toDataURL(false)));
              }
          }
          final JSONObject object = new JSONObject();
  
          object.put("type", new JSONString(getShapeType().getValue()));
  
          if (hasMetaData())
          {
              final MetaData meta = getMetaData();
  
              if (false == meta.isEmpty())
              {
                  object.put("meta", new JSONObject(meta.getJSO()));
              }
          }
          object.put("attributes", attr);
  
          final ImageDataFilterChain chain = getImageProxy().getFilterChain();
  
          if ((null != chain) && (chain.size() > 0))
          {
              final JSONArray filters = new JSONArray();
  
              final JSONObject filter = new JSONObject();
  
              filter.put("active", JSONBoolean.getInstance(chain.isActive()));
  
              for (final ImageDataFilter<?> ifilter : chain.getFilters())
              {
                  if (null != ifilter)
                  {
                      final JSONObject make = ifilter.toJSONObject();
  
                      if (null != make)
                      {
                          filters.set(filters.size(), make);
                      }
                  }
              }
              filter.put("filters", filters);
  
              object.put("filter", filter);
          }
          return object;
      }
docs: Serializes this shape as a {@link JSONObject}
  
  @return JSONObject