-
Notifications
You must be signed in to change notification settings - Fork 0
pandoc base64 img2file
This is the documentation for pandoc-base64-img2file.pl.
pandoc -F pandoc-base64-img2file.pl \
[-M image_dir=decoded_images] \
-f html some.html -t FORMAT -o FILE
Pandoc filter which intercepts image elements with data URIs with Base64 encoded image data, decodes the data and writes the image to a file with a hopefully correct extension in a directory designated by the user as a metadata value, then replaces the URL in the output document with the path to that file.
image_dir defaults to ./decoded_images
Filenames are on the pattern "decodedImage0000.EXT", where "0000" is incremented for each data URI encountered and "EXT" actually is whatever comes after "image/" in the MIME type of the data URI.
You must make sure that there is no whitespace in the data URIs in the source, and thus that each is all on one line, or pandoc will become confused.
Images files are overwritten with each run. Switch image directory or rename the old directory if that is a problem.
Data::Rmap
Data::Util
JSON::MaybeXS
List::AllUtils~0.09
MIME::Base64::Perl
Path::Tiny~0.011