Skip to content

Commit

Permalink
save higher (although still surprisingly low) quality jpegs
Browse files Browse the repository at this point in the history
  • Loading branch information
slyrus committed Mar 14, 2011
1 parent d71ae36 commit f9e7057
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions jpeg.lisp
Expand Up @@ -7,6 +7,8 @@
(defconstant +ncomp-rgb+ 3)

(defparameter *rgb-sampling* '((1 1)(1 1)(1 1)))
(defparameter *rgb-q-tabs* (vector jpeg::*q-luminance-hi*
jpeg::*q-chrominance-hi*))
(defparameter *gray-q-tabs* (vector jpeg::*q-luminance*))

;;;
Expand Down Expand Up @@ -79,8 +81,9 @@
(aref jpeg-array (incf pixoff)) g
(aref jpeg-array (incf pixoff)) r)))))
(jpeg::encode-image-stream stream jpeg-array +ncomp-rgb+ height width
:sampling *rgb-sampling*))))

:sampling *rgb-sampling*
:q-tabs *rgb-q-tabs*))))

;; NB: The JPEG format doesn't, AAICT, have a well-specified way
;; of writing an RGBA image. So, for now at least, we'll punt and
;; write it as an RGB image.
Expand All @@ -102,7 +105,8 @@
(aref jpeg-array (incf pixoff)) g
(aref jpeg-array (incf pixoff)) r)))))
(jpeg::encode-image-stream stream jpeg-array +ncomp-rgb+ height width
:sampling *rgb-sampling*))))
:sampling *rgb-sampling*
:q-tabs *rgb-q-tabs*))))

(t (error "Cannot write a JPEG image from ~A" (type-of image)))))

Expand Down

0 comments on commit f9e7057

Please sign in to comment.