mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix incorrect error being raised when trying load a None object as an
image with imagemagick.
This commit is contained in:
parent
ad5a5cc20e
commit
57437fb0b0
@ -60,12 +60,12 @@ class FontMetrics(object):
|
||||
|
||||
# }}}
|
||||
|
||||
class PixelWand(_magick.PixelWand): # {{{
|
||||
class PixelWand(_magick.PixelWand): # {{{
|
||||
pass
|
||||
|
||||
# }}}
|
||||
|
||||
class DrawingWand(_magick.DrawingWand): # {{{
|
||||
class DrawingWand(_magick.DrawingWand): # {{{
|
||||
|
||||
@dynamic_property
|
||||
def font(self):
|
||||
@ -117,7 +117,7 @@ class DrawingWand(_magick.DrawingWand): # {{{
|
||||
|
||||
# }}}
|
||||
|
||||
class Image(_magick.Image): # {{{
|
||||
class Image(_magick.Image): # {{{
|
||||
|
||||
@property
|
||||
def clone(self):
|
||||
@ -126,9 +126,9 @@ class Image(_magick.Image): # {{{
|
||||
return ans
|
||||
|
||||
def load(self, data):
|
||||
data = bytes(data)
|
||||
if not data:
|
||||
raise ValueError('Cannot open image from empty data string')
|
||||
data = bytes(data)
|
||||
return _magick.Image.load(self, data)
|
||||
|
||||
def open(self, path_or_file):
|
||||
@ -165,7 +165,6 @@ class Image(_magick.Image): # {{{
|
||||
self.type_ = val
|
||||
return property(fget=fget, fset=fset, doc=_magick.Image.type_.__doc__)
|
||||
|
||||
|
||||
@dynamic_property
|
||||
def size(self):
|
||||
def fget(self):
|
||||
@ -181,7 +180,6 @@ class Image(_magick.Image): # {{{
|
||||
self.size_ = (int(val[0]), int(val[1]), filter, blur)
|
||||
return property(fget=fget, fset=fset, doc=_magick.Image.size_.__doc__)
|
||||
|
||||
|
||||
def save(self, path, format=None):
|
||||
if format is None:
|
||||
ext = os.path.splitext(path)[1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user