Closed knobo closed 2 years ago
I was not able to compile the master branch so I did not provide a pull request. There was a missing tiff2 package.
@knobo tiff2 is in the latest retrospectiff. thanks for the patch. i'll take a look in more detail later today.
@knobo do you have any sample CMYK jpeg images? I don't think cl-jpeg lets me write CMYK images.
You can create with ImageMagick convert -colorspace CMYK file-rbg.jpg file-cmyk.jpg
$ convert -colorspace RGB -size 100x100 xc:#990000 test-rgb.jpg
$ convert -colorspace CMYK -size 100x100 xc:#990000 test-cmyk.jpg
$ identify -verbose test-* | grep -i colorspace
Colorspace: CMYK
jpeg:colorspace: 4
Colorspace: sRGB
jpeg:colorspace: 2
In the example in my comment I used ImageMagics command "convert" In case you don't have ImageMagic installed, I send the files here:
test-cmyk:
test-rgb
Thanks for the suggestion. I've adapted your approach, modified it a bit and committed it.
Just out of curiosity, why do you use let
instead of for
(loop for j below width
do
(let ((pixoff (* +ncomp-rgb+ (+ (* i width) j))))
(setf (pixel image i j)
(values (aref buffer (+ 2 pixoff))
(aref buffer (+ 1 pixoff))
(aref buffer pixoff)))))
instead of
(loop for j below width
for pixoff = (* +ncomp-rgb+ (+ (* i width) j))
do
(setf (pixel image i j)
(values (aref buffer (+ 2 pixoff))
(aref buffer (+ 1 pixoff))
(aref buffer pixoff)))))
If I was not going to use loop features, then I'd use dotimes
instead
(dotimes (j width)
(let ((pixoff (* +ncomp-rgb+ (+ (* i width) j))))
(setf (pixel image i j)
(values (aref buffer (+ 2 pixoff))
(aref buffer (+ 1 pixoff))
(aref buffer pixoff)))))
With the latest cl-jpeg package we can read cmyk files. Here is an example on how to do it: