-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compress images for PDF/EPUB #171
Comments
I can only find rtd rst docs on including images, not compressing them. Compression can either be done to the images before they are included or after by ghostscript or something. Ghostscript at least takes the dpi of the output into account. It's worth noting that no matter what you do, the screenshots stored in png format are going to have compression artifacts. svg is preferred. |
After further review, this issue will inevitably conflict with #129. Compressing the images removes the ability to embed image meta data. There are also issues with being unable to determine which build was completed (HTML, latexpdf, epub), as well as Sphinx embedding fonts into the PDF. I'll leave this issue open, but not a priority for a bit. |
We may be able to check metadata of the image to verify if it's labview embeddable or not. |
# pip install pypng
import png
VI_CHUNK_TYPE = bytes("niVI", "utf-8")
def is_image_a_vi_snippet(image_path):
with open(image_path, "rb") as image:
reader = png.Reader(bytes=image.read())
for chunk_type, chunk_data in reader.chunks():
if chunk_type == VI_CHUNK_TYPE:
return True
return False works for identifying if an image is a labview snippet. From https://github.com/rcpacini/labview_snippet, vi snippets are stored in extra png chunks. |
Should be a way to do this without running a script.
The text was updated successfully, but these errors were encountered: