mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
EPUB Output: Auto convert CMYK images to RGB
Works around Adobe Digital Editions inablity to display CMYK images. See #1246710 (Frontpage is not apearing in the readerprogram)
This commit is contained in:
parent
6a14af6f99
commit
9b71d8ed9e
@ -53,12 +53,24 @@ class RescaleImages(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if self.check_colorspaces and img.colorspace == 'CMYKColorspace':
|
if self.check_colorspaces and img.colorspace == 'CMYKColorspace':
|
||||||
# We cannot do an automatic conversion of CMYK to RGB as
|
# We cannot do an imagemagick conversion of CMYK to RGB as
|
||||||
# ImageMagick inverts colors if you just set the colorspace
|
# ImageMagick inverts colors if you just set the colorspace
|
||||||
# to rgb. See for example: https://bugs.launchpad.net/bugs/1246710
|
# to rgb. See for example: https://bugs.launchpad.net/bugs/1246710
|
||||||
self.log.warn(
|
from PyQt4.Qt import QImage
|
||||||
'The image %s is in the CMYK colorspace, you should convert'
|
from calibre.gui2 import pixmap_to_data
|
||||||
' it to sRGB as Adobe Digital Editions cannot render CMYK' % item.href)
|
qimg = QImage()
|
||||||
|
qimg.loadFromData(raw)
|
||||||
|
if not qimg.isNull():
|
||||||
|
raw = item.data = pixmap_to_data(qimg, format=ext, quality=95)
|
||||||
|
img = Image()
|
||||||
|
img.load(raw)
|
||||||
|
self.log.warn(
|
||||||
|
'The image %s is in the CMYK colorspace, converting it '
|
||||||
|
'to RGB as Adobe Digital Editions cannot display CMYK' % item.href)
|
||||||
|
else:
|
||||||
|
self.log.warn(
|
||||||
|
'The image %s is in the CMYK colorspace, you should convert'
|
||||||
|
' it to sRGB as Adobe Digital Editions cannot render CMYK' % item.href)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user