Skip to content

Fix: Ensure GIF and TIFF are treated as images #12159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Files.App/Helpers/BitmapHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public static async Task Rotate(string filePath, BitmapRotation rotation)
using var memStream = new InMemoryRandomAccessStream();
BitmapEncoder encoder = await BitmapEncoder.CreateForTranscodingAsync(memStream, decoder);

for (int i = 0; i < decoder.FrameCount - 1; i++)
{
encoder.BitmapTransform.Rotation = rotation;
await encoder.GoToNextFrameAsync();
}

encoder.BitmapTransform.Rotation = rotation;

await encoder.FlushAsync();
Expand Down
2 changes: 1 addition & 1 deletion src/Files.Backend/Helpers/FileExtensionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static bool HasExtension(string? filePathToCheck, params string[] extensi
/// <returns><c>true</c> if the fileExtensionToCheck is an image;
/// otherwise, <c>false</c>.</returns>
public static bool IsImageFile(string? fileExtensionToCheck)
=> HasExtension(fileExtensionToCheck, ".png", ".bmp", ".jpg", ".jpeg");
=> HasExtension(fileExtensionToCheck, ".png", ".bmp", ".jpg", ".jpeg", ".gif", ".tiff", ".tif");

/// <summary>
/// Check if the file extension is a PowerShell script.
Expand Down