diff options
author | Arun Isaac | 2020-07-18 05:46:59 +0530 |
---|---|---|
committer | Arun Isaac | 2020-07-18 05:46:59 +0530 |
commit | 9b53537b89d83fd7ade6a8707bb932d46564519a (patch) | |
tree | a8b2e688a14d635df1c8817a232250f26b1af082 /ennu-image.el | |
parent | 3f3b55cdff2310f519e4cbc41b23d68e2e4d3f17 (diff) | |
download | ennum-9b53537b89d83fd7ade6a8707bb932d46564519a.tar.gz ennum-9b53537b89d83fd7ade6a8707bb932d46564519a.tar.lz ennum-9b53537b89d83fd7ade6a8707bb932d46564519a.zip |
Rename ennu to ennum.
* ennu.el: Rename to ...
* ennum.el: ... this. Replace all instances of ennu with ennum.
* ennu-html.el: Rename to ...
* ennum-html.el: ... this. Replace all instances of ennu with ennum.
* ennu-image.el: Rename to ...
* ennum-image.el: ... this. Replace all instances of ennu with ennum.
Diffstat (limited to 'ennu-image.el')
-rw-r--r-- | ennu-image.el | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/ennu-image.el b/ennu-image.el deleted file mode 100644 index 34c3e7e..0000000 --- a/ennu-image.el +++ /dev/null @@ -1,55 +0,0 @@ -;; -*- lexical-binding: t -*- - -(require 'image) -(require 'seq) - -;; Check if all necessary image types are supported -(seq-do (lambda (image-type) - (unless (image-type-available-p image-type) - (lwarn '(ennu) :error "`%s' image type not supported" image-type))) - '(jpeg png svg)) - -;; Check for existence of external image processing utilities -(seq-do (lambda (external-program) - (unless (executable-find external-program) - (lwarn '(ennu) :error "`%s' not found" external-program))) - '("convert" "identify" "jpegtran" "optipng")) - -(defun ennu-image-resize-image (infile-path outfile-path width) - "A simple shell wrapper around ImageMagick's convert" - (ennu-image--assert-file-exists infile-path) - (cl-case (image-type infile-path) - (svg - (copy-file infile-path outfile-path t)) - (otherwise - (call-process "convert" nil nil nil - infile-path "-resize" (format "%d>" width) outfile-path))) - outfile-path) - -(defun ennu-image-optimize-image (image-path) - "A simple shell wrapper around jpegtran and optipng" - (ennu-image--assert-file-exists image-path) - (cl-case (image-type image-path) - (jpeg - (call-process "jpegtran" nil nil nil "-optimize" - "-progressive" "-copy" "none" - "-outfile" image-path image-path)) - (png - (call-process "optipng" nil nil nil image-path))) - image-path) - -(defun ennu-image-get-width (image-path) - (ennu-image--assert-file-exists image-path) - (cl-case (image-type image-path) - (svg 1e+INF) - (otherwise - (with-temp-buffer - (call-process "identify" nil t nil - "-format" "%w" image-path) - (string-to-number (buffer-string)))))) - -(defun ennu-image--assert-file-exists (path) - (unless (file-exists-p path) - (error "File %s does not exist" path))) - -(provide 'ennu-image) |