[mew-dist 27213] Re: PNG

Kazu Yamamoto ( 山本和彦 ) kazu at example.com
2006年 8月 17日 (木) 10:20:16 JST


> > PNG も縮小でいるようになりました。
> 
>  この時点から、jpegの表示が遅くなりました。これはしかたがないので
> しょうか。

うーん。

以前は:JPEG → PNM (サイズ変更) → JPEG
現在は:JPEG → PNM (サイズ変更)

としていて、JPEG に戻さず、PNM を Emacs に表示させています。

元に戻さない分、速くなったと思っていましたが、Emacs は PNM を表示するの
が苦手なんでしょうか?

以下のパッチで、昔と同じ方式に戻ります。こちらの方が早いですか?

#僕の環境では、どちらとも言えません。

--かず

Index: mew-gemacs.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-gemacs.el,v
retrieving revision 1.39
diff -c -r1.39 mew-gemacs.el
*** mew-gemacs.el	14 Aug 2006 12:48:28 -0000	1.39
--- mew-gemacs.el	17 Aug 2006 01:17:48 -0000
***************
*** 185,208 ****
  (defvar mew-image-width-margin 45)
  
  (defvar mew-image-alist
!   '((jpeg "jpegtopnm" mew-jpeg-width)
!     (png  "pngtopnm"  mew-png-width)))
  
  (defun mew-image-format-ent (format)
    (assoc format mew-image-alist))
  
! (defun mew-image-get-prog (ent)
    (nth 1 ent))
  
! (defun mew-image-get-func (ent)
    (nth 2 ent))
  
  (defun mew-mime-image (cache begin end format)
    (message "Loading image...")
    (set-buffer (mew-buffer-message))
    (let* ((width (- (frame-pixel-width (selected-frame)) mew-image-width-margin))
  	 (ent (mew-image-format-ent format))
! 	 (prog (mew-image-get-prog ent))
  	 (func (mew-image-get-func ent))
  	 image-width image)
      (when (and func (fboundp func))
--- 185,212 ----
  (defvar mew-image-width-margin 45)
  
  (defvar mew-image-alist
!   '((jpeg "jpegtopnm" "pnmtojpeg" mew-jpeg-width)
!     (png  "pngtopnm"  "pnmtopng"  mew-png-width)))
  
  (defun mew-image-format-ent (format)
    (assoc format mew-image-alist))
  
! (defun mew-image-topnm (ent)
    (nth 1 ent))
  
! (defun mew-image-frompnm (ent)
    (nth 2 ent))
  
+ (defun mew-image-get-func (ent)
+   (nth 3 ent))
+ 
  (defun mew-mime-image (cache begin end format)
    (message "Loading image...")
    (set-buffer (mew-buffer-message))
    (let* ((width (- (frame-pixel-width (selected-frame)) mew-image-width-margin))
  	 (ent (mew-image-format-ent format))
! 	 (topnm (mew-image-topnm ent))
! 	 (frompnm (mew-image-frompnm ent))
  	 (func (mew-image-get-func ent))
  	 image-width image)
      (when (and func (fboundp func))
***************
*** 210,226 ****
  	(set-buffer cache)
  	(goto-char begin)
  	(setq image-width (funcall func))))
!     (if (and image-width (< width image-width) (mew-which-exec prog))
  	(with-temp-buffer
  	  (message "Resizing image...")
  	  (insert-buffer-substring cache begin end)
  	  (mew-set-buffer-multibyte nil)
! 	  (call-process-region (point-min) (point-max) prog
  			       t '(t nil) nil)
  	  (call-process-region (point-min) (point-max) "pnmscale"
  			       t '(t nil) nil
  			       "-xsize" (format "%d" width))
! 	  (setq format 'pbm)
  	  (setq image (mew-buffer-substring (point-min) (point-max)))
  	  (message "Resizing image...done"))
        (save-excursion
--- 214,231 ----
  	(set-buffer cache)
  	(goto-char begin)
  	(setq image-width (funcall func))))
!     (if (and image-width (< width image-width) (mew-which-exec topnm))
  	(with-temp-buffer
  	  (message "Resizing image...")
  	  (insert-buffer-substring cache begin end)
  	  (mew-set-buffer-multibyte nil)
! 	  (call-process-region (point-min) (point-max) topnm
  			       t '(t nil) nil)
  	  (call-process-region (point-min) (point-max) "pnmscale"
  			       t '(t nil) nil
  			       "-xsize" (format "%d" width))
! 	  (call-process-region (point-min) (point-max) frompnm
! 			       t '(t nil) nil)
  	  (setq image (mew-buffer-substring (point-min) (point-max)))
  	  (message "Resizing image...done"))
        (save-excursion



Mew-dist メーリングリストの案内