Commit fff5a3b7 authored by Davis King's avatar Davis King

Defined the jpeg quality measure.

parent 264c2b6d
......@@ -48,6 +48,11 @@ namespace dlib
"\t save_jpeg()"
<< "\n\t You can't save an empty image as a JPEG."
);
DLIB_CASSERT(0 <= quality && quality <= 100,
"\t save_jpeg()"
<< "\n\t Invalid quality value."
<< "\n\t quality: " << quality
);
FILE* outfile = fopen(filename.c_str(), "wb");
if (!outfile)
......@@ -104,6 +109,12 @@ namespace dlib
"\t save_jpeg()"
<< "\n\t You can't save an empty image as a JPEG."
);
DLIB_CASSERT(0 <= quality && quality <= 100,
"\t save_jpeg()"
<< "\n\t Invalid quality value."
<< "\n\t quality: " << quality
);
FILE* outfile = fopen(filename.c_str(), "wb");
if (!outfile)
......
......@@ -25,6 +25,7 @@ namespace dlib
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h or a matrix expression
- image.size() != 0
- 0 <= quality <= 100
ensures
- writes the image to the file indicated by file_name in the JPEG format.
- image[0][0] will be in the upper left corner of the image.
......@@ -34,6 +35,8 @@ namespace dlib
save_jpeg() can only natively store rgb_pixel and uint8 pixel types. All
other pixel types will be converted into one of these types as appropriate
before being saved to disk.
- The quality value determines how lossy the compression is. Larger quality
values result in larger output images but the images will look better.
throws
- image_save_error
This exception is thrown if there is an error that prevents us from saving
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment