Skip to content

Commit 5d9dc0f

Browse files
committed
GetBitmap: fix rotated image orientation
resolves #47
1 parent 9ee7b22 commit 5d9dc0f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Spectrogram/ImageMaker.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,13 @@ public Bitmap GetBitmap(List<double[]> ffts)
8282

8383
for (int row = 0; row < Height; row++)
8484
{
85-
double value = IsRotated ? ffts[row][sourceCol] : ffts[sourceCol][row];
85+
double value = IsRotated
86+
? ffts[Height - row - 1][sourceCol]
87+
: ffts[sourceCol][row];
88+
8689
if (IsDecibel)
8790
value = 20 * Math.Log10(value * DecibelScaleFactor + 1);
91+
8892
value *= Intensity;
8993
value = Math.Min(value, 255);
9094
int bytePosition = (Height - 1 - row) * stride + col;

0 commit comments

Comments
 (0)