Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit b12934a5 authored by Jason Kridner's avatar Jason Kridner
Browse files

conf.py: attempt to add webp to png conversion for pdfs

parent 126d6e5c
Branches
Tags
1 merge request!45Lingering deltas from Jason
......@@ -28,9 +28,28 @@ sys.path.append(os.path.abspath("./_ext"))
extensions = [
"callouts",
"sphinxcontrib.rsvgconverter",
"sphinx_design"
"sphinx_design",
"sphinxcontrib.images",
"sphinx.ext.imgconverter"
]
from sphinx.ext import imgconverter
class WebPConverter(imgconverter.ImageConverter):
def apply(self, source, target):
import os
from PIL import Image
ext = os.path.splitext(source)[-1].lower()
if ext == '.webp':
with Image.open(source) as img:
img.save(target, format='PNG')
else:
super().apply(source, target)
if 'latex' in tags:
imgconverter = WebPConverter
templates_path = ['_templates']
source_suffix = '.rst'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment