Skip to content

Commit

Permalink
If `convert' is not required, it is not invoked.
Browse files Browse the repository at this point in the history
(twittering-retrieve-image): Do not invoke `convert' if Emacs supports
the image type and resize is not required.
  • Loading branch information
cvmat authored and hayamiz committed Jan 10, 2010
1 parent a328d85 commit 3d7f497
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -60,6 +60,8 @@

* twittering-mode.el (twittering-image-type): Try to detect image
type with `image-type-from-data' at first.
(twittering-retrieve-image): Do not invoke `convert' if Emacs
supports the image type and resize is not required.

2010-01-08 Yuto Hayamizu <y.hayamizu@gmail.com>

Expand Down
13 changes: 11 additions & 2 deletions twittering-mode.el
Expand Up @@ -1965,7 +1965,10 @@ following symbols;
(let ((image-data (gethash `(,image-url . ,twittering-convert-fix-size)
twittering-image-data-table)))
(when (not image-data)
(let ((image-type nil))
(let ((image-type nil)
(image-spec nil)
(converted-image-size
`(,twittering-convert-fix-size . ,twittering-convert-fix-size)))
(with-temp-buffer
(set-buffer-multibyte nil)
(let ((coding-system-for-read 'binary)
Expand All @@ -1974,7 +1977,13 @@ following symbols;
(url-insert-file-contents image-url)
(setq image-type (twittering-image-type image-url
(current-buffer)))
(when (and twittering-convert-fix-size twittering-use-convert)
(setq image-spec `(image :type ,image-type
:data ,(buffer-string)))
(when (and twittering-convert-fix-size twittering-use-convert
(not
(and (image-type-available-p image-type)
(equal (image-size image-spec t)
converted-image-size))))
(call-process-region
(point-min) (point-max)
twittering-convert-program
Expand Down

0 comments on commit 3d7f497

Please sign in to comment.