Quote:
Originally Posted by scissors
I went to an imagemagik sit and found the -colorspace command. I tried colorspace=gray but calibre gives errors.
|
Did you implement it in a recipe and import as needed? My code for rotating images is in the sticky code thread of the recipe forum. You can see there how I used the rotate options.
Spoiler:
Code:
#Add these imports
from calibre.utils.magick import Image, PixelWand
def postprocess_html(self, soup, first):
#process all the images. assumes that the new html has the correct path
for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')):
iurl = tag['src']
img = Image()
img.open(iurl)
width, height = img.size
print 'img is: ', iurl, 'width is: ', width, 'height is: ', height
if img < 0:
raise RuntimeError('Out of memory')
pw = PixelWand()
if( width > height ) :
print 'Rotate image'
img.rotate(pw, -90)
img.save(iurl)
return soup