using CloudinaryDotNet.Actions;
namespace CloudinaryUpload
private static string cloudName = "elukas";
private static string ApiKey = "492925274929739";
private static string ApiSecret = "181v3eel4XGWvQtrvhGT1MjPOvc";
public static void Main()
string publicId = "Flyer2";
string headshotPublicId = "Profile:profile_erwin_lukas";
string companyLogoPublicId = "Profile:cld";
Account account = new Account(cloudName,ApiKey,ApiSecret);
Cloudinary cloudinary = new Cloudinary(account);
cloudinary.Api.Timeout = int.MaxValue;
var getResource = new GetResourceParams(publicId){
var info = cloudinary.GetResource(getResource);
var layerRectanglesStr = info.Metadata["LayerRectangles"];
var layerRectangles = layerRectanglesStr.Split(new string[] {", "}, StringSplitOptions.RemoveEmptyEntries);
var headshotStrArr = layerRectangles[2].Split(new char[] {' '}, StringSplitOptions.None);
var companyLogoStrArr = layerRectangles[3].Split(new char[] {' '}, StringSplitOptions.None);
int[] headshot = new int[4];
for (var i = 0; i < headshotStrArr.Length; i++)
headshot[i] = int.Parse(headshotStrArr[i]);
int[] companyLogo = new int[4];
for (var i = 0; i < companyLogoStrArr.Length; i++)
companyLogo[i] = int.Parse(companyLogoStrArr[i]);
string url = cloudinary.Api.UrlImgUp.Transform(
.Overlay(new Layer().PublicId(headshotPublicId))
.Width(headshot[3]-headshot[1])
.Height(headshot[2]-headshot[0])
.Overlay(new Layer().PublicId(companyLogoPublicId))
.Width(companyLogo[3]-companyLogo[1])
.Height(companyLogo[2]-companyLogo[0])
).BuildUrl(publicId+".jpg");