Skip to content
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

HTML manual Retina resolution animated gifs #1160

Closed
gracjan opened this issue Feb 16, 2016 · 1 comment
Closed

HTML manual Retina resolution animated gifs #1160

gracjan opened this issue Feb 16, 2016 · 1 comment

Comments

@gracjan
Copy link
Contributor

gracjan commented Feb 16, 2016

Write an Emacs function that will change IMG tags in documentation from:

<img src="xxx.gif">

to

<img width="W" height="H" src="xxx.gif">

where W and H are half of gif width and height. (Half because screenshots are made on retina display).

Invocation should be:

emacs -l haskell-manual-gif-size-fixup.el -f haskell-manual-gif-size-fixup-batch-and-exit *.html
@gracjan
Copy link
Contributor Author

gracjan commented Feb 16, 2016

To get gif dimensions:

(defun get-gif-dimensions (filename)
  (interactive "fFile name:")
  (with-temp-buffer
    (insert-file-contents-literally filename nil 0 10 nil)
    (let ((result
           (cons (+ (char-after 7) (* 256 (char-after 8)))
                 (+ (char-after 9) (* 256 (char-after 10))))))
      (if (called-interactively-p)
          (message "Dimensions: %dx%d" (car result) (cdr result)))
      result)))

@gracjan gracjan changed the title Write gif size fixups HTML manual Retina resolution animated gifs Feb 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant