diff --git a/coders/jpeg.c b/coders/jpeg.c
index 319c45e..9408d23 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -2251,9 +2251,9 @@
(void) DeleteImageOption(jpeg_info,"jpeg:extent");
(void) AcquireUniqueFilename(jpeg_image->filename);
maximum=101;
- for (minimum=0; minimum != maximum; )
+ for (minimum=2; minimum != maximum; )
{
- jpeg_image->quality=minimum+(maximum-minimum)/2;
+ jpeg_image->quality=minimum+(maximum-minimum+1)/2;
status=WriteJPEGImage(jpeg_info,jpeg_image,exception);
if (GetBlobSize(jpeg_image) <= extent)
minimum=jpeg_image->quality+1;