Mercurial > hg > digilib
changeset 1211:250cd5139121
added getOutputMimeType()
author | casties |
---|---|
date | Mon, 26 Aug 2013 15:19:34 +0200 |
parents | 247eab96bf04 |
children | 8bc9d0602708 |
files | common/src/main/java/digilib/image/ImageJobDescription.java |
diffstat | 1 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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. *