don't save RGBA as JPG CMYK

This commit is contained in:
John Cupitt 2012-06-18 09:08:02 +01:00
parent df572e092b
commit 2b432723f4
2 changed files with 18 additions and 2 deletions

6
TODO
View File

@ -1,3 +1,9 @@
- on RGBA -> RGB conversion in foreign.c, need to use A channel to mask off
RGB ... Opera.png looks bad without it
blocking bugs
=============

View File

@ -1160,9 +1160,18 @@ vips_foreign_convert_saveable( VipsForeignSave *save )
in = out;
}
else if( in->Bands > 3 &&
class->saveable == VIPS_SAVEABLE_RGB ) {
(class->saveable == VIPS_SAVEABLE_RGB ||
(class->saveable == VIPS_SAVEABLE_RGB_CMYK &&
in->Type != VIPS_INTERPRETATION_CMYK)) ) {
VipsImage *out;
/* Don't let 4 bands though unless the image really is
* a CMYK.
*
* Consider a RGBA png being saved as JPG. We can
* write CMYK jpg, but we mustn't do that for RGBA
* images.
*/
if( vips_extract_band( in, &out, 0,
"n", 3,
NULL ) ) {
@ -1174,7 +1183,8 @@ vips_foreign_convert_saveable( VipsForeignSave *save )
in = out;
}
else if( in->Bands > 4 &&
(class->saveable == VIPS_SAVEABLE_RGB_CMYK ||
((class->saveable == VIPS_SAVEABLE_RGB_CMYK &&
in->Type == VIPS_INTERPRETATION_CMYK) ||
class->saveable == VIPS_SAVEABLE_RGBA) ) {
VipsImage *out;