mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2852: imgconverter: Support to convert GIF to PNG
This commit is contained in:
parent
23796c35bf
commit
d97468bd5d
1
CHANGES
1
CHANGES
@ -30,6 +30,7 @@ Features added
|
||||
value
|
||||
* :confval:`source_suffix` allows a mapping fileext to file types
|
||||
* Add :confval:`author` as a configuration value
|
||||
* #2852: imgconverter: Support to convert GIF to PNG
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
@ -28,6 +28,7 @@ logger = logging.getLogger(__name__)
|
||||
class ImagemagickConverter(ImageConverter):
|
||||
conversion_rules = [
|
||||
('image/svg+xml', 'image/png'),
|
||||
('image/gif', 'image/png'),
|
||||
('application/pdf', 'image/png'),
|
||||
]
|
||||
|
||||
@ -52,6 +53,10 @@ class ImagemagickConverter(ImageConverter):
|
||||
# type: (unicode, unicode) -> bool
|
||||
"""Converts the image to expected one."""
|
||||
try:
|
||||
if _from.lower().endswith('.gif'):
|
||||
# when target is GIF format, pick the first frame
|
||||
_from += '[0]'
|
||||
|
||||
args = ([self.config.image_converter] +
|
||||
self.config.image_converter_args +
|
||||
[_from, _to])
|
||||
|
Loading…
Reference in New Issue
Block a user