mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 23:03:51 +02:00
Crop print border on upload
This commit is contained in:
@@ -204,13 +204,9 @@ namespace VRCX
|
||||
var ms = new MemoryStream(bytes);
|
||||
var print = await Image.LoadAsync(ms);
|
||||
// validation step to ensure image is actually a print
|
||||
if (print.Width != 2048 || print.Height != 1440)
|
||||
if (!CropPrint(ref print))
|
||||
return false;
|
||||
|
||||
var point = new Point(64, 69);
|
||||
var size = new Size(1920, 1080);
|
||||
var rectangle = new Rectangle(point, size);
|
||||
print.Mutate(x => x.Crop(rectangle));
|
||||
|
||||
await print.SaveAsPngAsync(tempPath);
|
||||
if (ScreenshotHelper.HasTXt(path))
|
||||
ScreenshotHelper.CopyTXt(path, tempPath);
|
||||
@@ -218,6 +214,18 @@ namespace VRCX
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CropPrint(ref Image image)
|
||||
{
|
||||
if (image.Width != 2048 || image.Height != 1440)
|
||||
return false;
|
||||
|
||||
var point = new Point(64, 69);
|
||||
var size = new Size(1920, 1080);
|
||||
var rectangle = new Rectangle(point, size);
|
||||
image.Mutate(x => x.Crop(rectangle));
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<string> SavePrintToFile(string url, string ugcFolderPath, string monthFolder, string fileName)
|
||||
{
|
||||
var folder = Path.Join(GetUGCPhotoLocation(ugcFolderPath), "Prints", MakeValidFileName(monthFolder));
|
||||
|
||||
Reference in New Issue
Block a user