From df10126e2d1d0c5e10ec815bde816e45c4995d4a Mon Sep 17 00:00:00 2001 From: Alexey Korobko <32317929+akorobko@users.noreply.github.com> Date: Thu, 28 Dec 2023 06:25:44 -0800 Subject: [PATCH] Support images other than PNG (#27) --- StreamDeckSDK/ESDConnectionManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/StreamDeckSDK/ESDConnectionManager.cpp b/StreamDeckSDK/ESDConnectionManager.cpp index dd9c96e..dccd059 100644 --- a/StreamDeckSDK/ESDConnectionManager.cpp +++ b/StreamDeckSDK/ESDConnectionManager.cpp @@ -232,14 +232,15 @@ void ESDConnectionManager::SetImage( json payload; payload[kESDSDKPayloadTarget] = inTarget; - const std::string prefix = "data:image/png;base64,"; + const std::string pngPrefix = "data:image/png;base64,"; + const std::string prefix = "data:image/"; if ( inBase64ImageString.empty() || inBase64ImageString.substr(0, prefix.length()).find(prefix) == 0) payload[kESDSDKPayloadImage] = inBase64ImageString; else - payload[kESDSDKPayloadImage] - = "data:image/png;base64," + inBase64ImageString; + // assume Base64-encoded PNG image + payload[kESDSDKPayloadImage] = pngPrefix + inBase64ImageString; if (inState >= 0) { payload[kESDSDKPayloadState] = inState; }