diff Plugins/Engine/OrthancPlugins.cpp @ 1603:905b4db3092b

CompressAndAnswerJpegImage
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Sep 2015 13:08:41 +0200
parents 7151d63e6d81
children 1f5d6a2f9638
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp	Tue Sep 01 13:06:39 2015 +0200
+++ b/Plugins/Engine/OrthancPlugins.cpp	Tue Sep 01 13:08:41 2015 +0200
@@ -34,7 +34,6 @@
 
 #include "../../Core/ChunkedBuffer.h"
 #include "../../Core/HttpServer/HttpToolbox.h"
-#include "../../Core/ImageFormats/PngWriter.h"
 #include "../../Core/Logging.h"
 #include "../../Core/OrthancException.h"
 #include "../../Core/Toolbox.h"
@@ -45,6 +44,7 @@
 #include "../../Core/Compression/GzipCompressor.h"
 #include "../../Core/ImageFormats/PngReader.h"
 #include "../../Core/ImageFormats/PngWriter.h"
+#include "../../Core/ImageFormats/JpegWriter.h"
 
 #include <boost/regex.hpp> 
 
@@ -720,8 +720,11 @@
 
       case OrthancPluginImageFormat_Jpeg:
       {
-        // TODO 
-        // quality
+        JpegWriter writer;
+        writer.SetQuality(p.quality);
+        writer.WriteToMemory(compressed, accessor);
+        translatedOutput->SetContentType("image/jpeg");
+        break;
       }
 
       default: