     }
     
     fileprivate func encode(using storageType: MediaType, resolution: Resolution, properties: Any) -> String? {
-        guard let mediaType = storageType.media_type_string else { return nil }
+        guard let mediaType = storageType._mimeType?.serialize() else { return nil }
         guard let properties = properties as? [ImageRep.PropertyKey : Any] else { return nil }
         guard let data = self.representation(using: storageType, properties: properties) else { return nil }
         return "data:\(mediaType);base64," + data.base64EncodedString()


extension MediaType {
    
    fileprivate var media_type_string: String? {
        switch self {
        case .bmp: return "image/bmp"
        case .gif: return "image/gif"
        case .heic: return "image/heic"
        case .heif: return "image/heif"
        case .jpeg: return "image/jpeg"
        case .jpeg2000: return "image/jp2"
        case .png: return "image/png"
        case .tiff: return "image/tiff"
        default: return nil
        }
    }

    }
    
    fileprivate func encode(using storageType: MediaType, resolution: Resolution, properties: Any) -> String? {
        guard let mediaType = storageType._mimeType?.serialize() else { return nil }
        guard let properties = properties as? [ImageRep.PropertyKey : Any] else { return nil }
        guard let data = self.representation(using: storageType, properties: properties) else { return nil }
        return "data:\(mediaType);base64," + data.base64EncodedString()
