# HG changeset patch # User casties # Date 1377523174 -7200 # Node ID 250cd5139121622d2e5c0079840035b35618ed98 # Parent 247eab96bf04119cb6b8824009b4a5df9208fd3f added getOutputMimeType() diff -r 247eab96bf04 -r 250cd5139121 common/src/main/java/digilib/image/ImageJobDescription.java --- a/common/src/main/java/digilib/image/ImageJobDescription.java Thu Aug 22 17:59:51 2013 +0200 +++ b/common/src/main/java/digilib/image/ImageJobDescription.java Mon Aug 26 15:19:34 2013 +0200 @@ -186,7 +186,7 @@ } /** - * Returns the mime-type (of the input). + * Returns the mime-type of the input. * * @return * @throws IOException @@ -199,6 +199,33 @@ return mimeType; } + + /** + * Return the mime-type of the output. + * + * @return + */ + public String getOutputMimeType() { + // forced destination image type + if (hasOption("jpg")) { + return "image/jpeg"; + } else if (hasOption("png")) { + return "image/png"; + } + // use input image type + try { + String mt = getMimeType(); + if ((mt.equals("image/jpeg") || mt.equals("image/jp2") || mt.equals("image/fpx"))) { + return "image/jpeg"; + } else { + return "image/png"; + } + } catch (IOException e) { + logger.error("No input when trying to getOutputMimeType!"); + } + return null; + } + /** * Set the current ImageInput. *