Skip to content
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

Fix #6: add settings for background color. Defaults to black #9

Merged
merged 1 commit into from
Oct 22, 2024
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
3 changes: 2 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public sealed class Settings
public bool ConvertOnlineLaunchboxGamesDB { get; set; } = true;
public uint GifColors { get; set; } = 32;
public string GifScaleMode { get; set; } = "fill";
public string BackgroundColor { get; set; } = "#000000";
}

public static Settings gSettings;
Expand Down Expand Up @@ -378,7 +379,7 @@ static void ConvertPicture(string inputPath, bool isGif)
image.Format = MagickFormat.Png32;
image.Modulate(new Percentage(100), new Percentage(150), new Percentage(100)); // Adjust brightness, saturation, and hue
//image.Trim(); // Trim the image to its bounding box
image.BackgroundColor = new MagickColor(0, 0, 0, 255); // Set the background color to black
image.BackgroundColor = new MagickColor(gSettings.BackgroundColor); // Set the background color to what the user likes (default is black)
//image.Alpha(AlphaOption.Opaque);
image.Compose = CompositeOperator.Over; // Over composite the image
image.Sample(width, height); // Resize the image to size provided by settings
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ The application uses a `settings.ini` file for configuration. You can specify:
- Output sizes (for 128x32 DMD and 256x64 DMD for example)
- Whether to download and convert from LaunchBox game DB (`ConvertOnlineLaunchboxGamesDB`)
- Whether to convert local GIF files (`ConvertLocalGifFiles`)
- The number of colors for GIF files
- Whether to fit the image inside the dimensions of the DMD or fill the DMD and crop
- The number of colors for GIF files (`GifColors`)
- Whether to fit the image inside the dimensions of the DMD or fill the DMD and crop (`GifScaleMode=fill|fit`)
- The background color for marquees (`BackgroundColor=#000000`, defaults to black)

```ini
[Settings]
Expand All @@ -112,6 +113,7 @@ LocalGifFolder=C:\path\to\your\gif\folder
GifColors=128
; GifScaleMode=fill or fit
GifScaleMode=fill
BackgroundColor=#000000
```

## Usage
Expand Down
1 change: 1 addition & 0 deletions settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LocalGifFolder="C:\path\to\your\gif\folder"
GifColors=128
; GifScaleMode=fill or fit
GifScaleMode=fill
BackgroundColor=#FF0000