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