Skip to content

Commit

Permalink
Merge pull request #56 from manzanotti/UseBackgroundTransform
Browse files Browse the repository at this point in the history
Added missing background transform to TinyPNG convert call
  • Loading branch information
ctolkien committed May 30, 2024
2 parents 7474a06 + c05d953 commit 270b429
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/TinyPNG/Extensions/ConvertExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ public static async Task<TinyPngConvertResponse> Convert(this Task<TinyPngCompre

TinyPngCompressResponse compressResponse = await result;

string requestBody = JsonSerializer.Serialize(new { convert = new { type = convertOperation } }, TinyPngClient._jsonOptions);
string requestBody = JsonSerializer.Serialize(new {
convert = new
{
type = convertOperation
},
transform = backgroundTransform == null ? null : new
{
background = backgroundTransform
}
}, TinyPngClient._jsonOptions);

HttpRequestMessage msg = new(HttpMethod.Post, compressResponse.Output.Url)
{
Expand Down

0 comments on commit 270b429

Please sign in to comment.