Feat: extract exr preview file to be displayed on GUI

This commit is contained in:
harlekin
2023-01-06 14:53:06 +00:00
committed by Sheepit Renderfarm
parent 3cb7b5fc5f
commit 690ad36adb
5 changed files with 48 additions and 11 deletions

View File

@@ -47,7 +47,6 @@ import javax.swing.border.EmptyBorder;
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import java.awt.Image;
@@ -64,7 +63,6 @@ import java.awt.image.BufferedImage;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;

View File

@@ -31,6 +31,7 @@ import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Objects;
@@ -416,8 +417,16 @@ public class Working implements Activity {
icon = new ImageIcon(getClass().getResource("/frame_power_detection.jpg"));
}
else {
String path = null;
try {
String path = lastJob.getOutputImagePath();
boolean hasPreview = lastJob.getPreviewImagePath() != null;
if (hasPreview) {
path = lastJob.getPreviewImagePath();
}
else {
path = lastJob.getOutputImagePath();
}
BufferedImage img = ImageIO.read(new File(path));
float width = img.getWidth();
@@ -433,7 +442,7 @@ public class Working implements Activity {
}
catch (Exception e) {
log.error(String.format("Working::showLastRender() Unable to load/preview rendered frame [%s]. Exception %s",
lastJob.getOutputImagePath(), e.getMessage()));
path, e.getMessage()));
}
}