Browse Source

Reorder parameters to be first, add json chunk

pull/165/head
Ionite 1 year ago
parent
commit
ae8283f612
No known key found for this signature in database
  1. 6
      StabilityMatrix.Avalonia/Helpers/PngDataHelper.cs

6
StabilityMatrix.Avalonia/Helpers/PngDataHelper.cs

@ -42,6 +42,9 @@ public static class PngDataHelper
+ $"Model hash: {generationParameters.ModelHash}, Model: {generationParameters.ModelName}"; + $"Model hash: {generationParameters.ModelHash}, Model: {generationParameters.ModelName}";
var paramsChunk = GetTextChunk("parameters", paramsData); var paramsChunk = GetTextChunk("parameters", paramsData);
var paramsJson = JsonSerializer.Serialize(generationParameters);
var paramsJsonChunk = GetTextChunk("parameters-json", paramsJson);
// Go back 4 from the idat index because we need the length of the data // Go back 4 from the idat index because we need the length of the data
idatIndex -= 4; idatIndex -= 4;
@ -50,8 +53,9 @@ public static class PngDataHelper
var actualImageData = inputImage[idatIndex..iendIndex]; var actualImageData = inputImage[idatIndex..iendIndex];
var finalImage = existingData var finalImage = existingData
.Concat(smprojChunk)
.Concat(paramsChunk) .Concat(paramsChunk)
.Concat(paramsJsonChunk)
.Concat(smprojChunk)
.Concat(actualImageData); .Concat(actualImageData);
return finalImage.ToArray(); return finalImage.ToArray();

Loading…
Cancel
Save