all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: thumbs.el and transparency
@ 2006-01-29 13:57 Xavier Maillard
  2006-01-29 20:14 ` Nick Roberts
  0 siblings, 1 reply; 101+ messages in thread
From: Xavier Maillard @ 2006-01-29 13:57 UTC (permalink / raw)
  Cc: miles, nickrob, brakjoller, emacs-devel

   From: "Richard M. Stallman" <rms@gnu.org>

   I don't like having two different thumbnail viewing packages;
   and the fact that they are not particularly coherent makes
   it even worse, by increasing the amount that users have to learn
   and remember in order to use them both.

That is also my point of view. Can these two modes be "merged" together ? That
would, at least, solve two of our problems.

Xavier

^ permalink raw reply	[flat|nested] 101+ messages in thread
* thumbs.el and transparency
@ 2006-01-25  1:08 Nick Roberts
  2006-01-25  7:59 ` Juri Linkov
  0 siblings, 1 reply; 101+ messages in thread
From: Nick Roberts @ 2006-01-25  1:08 UTC (permalink / raw)



Currently thumbs.el stores all thumbnails as jpeg images.  Some image formats
such as xpm allow transparency (do M-x thumbs on emacs/etc/images, for
example).  When converted to jpeg a transparent background is converted to a
black one, so if the foreground is also black you see nothing.

There has been a discussion about formats before and I don't wan't to undo
any of that.  How about the change below which creates thumbnails in the
same format as the image when its xpm xbm or pbm, and uses jpeg otherwise?

Nick


*** thumbs.el	24 Jan 2006 22:18:53 +1300	1.26
--- thumbs.el	25 Jan 2006 13:57:39 +1300	
***************
*** 195,201 ****
  
  (defun thumbs-temp-file ()
    "Return a unique temporary filename for an image."
!   (format "%s%s-%s.jpg"
            (thumbs-temp-dir)
            thumbs-temp-prefix
            (thumbs-gensym "T")))
--- 195,201 ----
  
  (defun thumbs-temp-file ()
    "Return a unique temporary filename for an image."
!   (format "%s%s-%s."
            (thumbs-temp-dir)
            thumbs-temp-prefix
            (thumbs-gensym "T")))
***************
*** 236,249 ****
    (thumbs-cleanup-thumbsdir))
  
  (defun thumbs-call-convert (filein fileout action
! 				   &optional arg output-format action-prefix)
    "Call the convert program.
  FILEIN is the input file,
  FILEOUT is the output file,
  ACTION is the command to send to convert.
  Optional arguments are:
  ARG any arguments to the ACTION command,
- OUTPUT-FORMAT is the file format to output (default is jpeg),
  ACTION-PREFIX is the symbol to place before the ACTION command
                (defaults to '-' but can sometimes be '+')."
    (let ((command (format "%s %s%s %s \"%s\" \"%s:%s\""
--- 236,248 ----
    (thumbs-cleanup-thumbsdir))
  
  (defun thumbs-call-convert (filein fileout action
! 				   &optional arg action-prefix)
    "Call the convert program.
  FILEIN is the input file,
  FILEOUT is the output file,
  ACTION is the command to send to convert.
  Optional arguments are:
  ARG any arguments to the ACTION command,
  ACTION-PREFIX is the symbol to place before the ACTION command
                (defaults to '-' but can sometimes be '+')."
    (let ((command (format "%s %s%s %s \"%s\" \"%s:%s\""
***************
*** 252,258 ****
  			 action
  			 (or arg "")
  			 filein
! 			 (or output-format "jpeg")
  			 fileout)))
      (call-process shell-file-name nil nil nil "-c" command)))
  
--- 251,257 ----
  			 action
  			 (or arg "")
  			 filein
! 			 (symbol-name (thumbs-image-thumb-type filein))
  			 fileout)))
      (call-process shell-file-name nil nil nil "-c" command)))
  
***************
*** 269,284 ****
  smaller according to whether INCREMENT is 1 or -1."
    (let* ((buffer-read-only nil)
  	 (old thumbs-current-tmp-filename)
  	 (x (or size
! 		(thumbs-new-image-size thumbs-current-image-size increment)))
! 	 (tmp (thumbs-temp-file)))
      (erase-buffer)
      (thumbs-call-convert (or old thumbs-current-image-filename)
  			 tmp "sample"
  			 (concat (number-to-string (car x)) "x"
  				 (number-to-string (cdr x))))
      (save-excursion
!       (thumbs-insert-image tmp 'jpeg 0))
      (setq thumbs-current-tmp-filename tmp)))
  
  (defun thumbs-resize-image (width height)
--- 268,284 ----
  smaller according to whether INCREMENT is 1 or -1."
    (let* ((buffer-read-only nil)
  	 (old thumbs-current-tmp-filename)
+ 	 (type (thumbs-image-thumb-type thumbs-current-image-filename))
+ 	 (tmp (concat (thumbs-temp-file) (symbol-name type)))
  	 (x (or size
! 		(thumbs-new-image-size thumbs-current-image-size increment))))
      (erase-buffer)
      (thumbs-call-convert (or old thumbs-current-image-filename)
  			 tmp "sample"
  			 (concat (number-to-string (car x)) "x"
  				 (number-to-string (cdr x))))
      (save-excursion
!       (thumbs-insert-image tmp type 0))
      (setq thumbs-current-tmp-filename tmp)))
  
  (defun thumbs-resize-image (width height)
***************
*** 300,306 ****
    "Return a thumbnail name for the image IMG."
    (convert-standard-filename
     (let ((filename (expand-file-name img)))
!      (format "%s%08x-%s.jpg"
               (thumbs-thumbsdir)
               (sxhash filename)
               (subst-char-in-string
--- 300,306 ----
    "Return a thumbnail name for the image IMG."
    (convert-standard-filename
     (let ((filename (expand-file-name img)))
!      (format (concat "%s%08x-%s." (symbol-name (thumbs-image-thumb-type img)))
               (thumbs-thumbsdir)
               (sxhash filename)
               (subst-char-in-string
***************
*** 333,338 ****
--- 333,344 ----
  	((string-match ".*\\.png\\'" img) 'png)
  	((string-match ".*\\.tiff?\\'" img) 'tiff)))
  
+ (defun thumbs-image-thumb-type (img)
+   (let ((type (thumbs-image-type img)))
+     (if (and (image-type-available-p type) (memq type '(xpm xbm pbm)))
+ 	type
+       'jpeg)))
+ 
  (defun thumbs-file-size (img)
    (let ((i (image-size (find-image `((:type ,(thumbs-image-type img) :file ,img))) t)))
      (concat (number-to-string (round (car i)))
***************
*** 363,369 ****
    "Insert the thumbnail for IMG at point.
  If MARKED is non-nil, the image is marked."
    (thumbs-insert-image
!    (thumbs-make-thumb img) 'jpeg thumbs-relief marked)
    (add-text-properties (1- (point)) (point)
  		     `(thumb-image-file ,img
  		       help-echo ,(file-name-nondirectory img))))
--- 369,375 ----
    "Insert the thumbnail for IMG at point.
  If MARKED is non-nil, the image is marked."
    (thumbs-insert-image
!    (thumbs-make-thumb img) (thumbs-image-thumb-type img) thumbs-relief marked)
    (add-text-properties (1- (point)) (point)
  		     `(thumb-image-file ,img
  		       help-echo ,(file-name-nondirectory img))))
***************
*** 623,630 ****
      (push elt thumbs-marked-list)
      (let ((inhibit-read-only t))
        (delete-char 1)
!       (save-excursion
! 	(thumbs-insert-thumb elt t))))
    (when (eolp) (forward-char)))
  
  (defun thumbs-unmark ()
--- 629,635 ----
      (push elt thumbs-marked-list)
      (let ((inhibit-read-only t))
        (delete-char 1)
!       (thumbs-insert-thumb elt t)))
    (when (eolp) (forward-char)))
  
  (defun thumbs-unmark ()
***************
*** 636,646 ****
      (setq thumbs-marked-list (delete elt thumbs-marked-list))
      (let ((inhibit-read-only t))
        (delete-char 1)
!       (save-excursion
! 	(thumbs-insert-thumb elt nil))))
    (when (eolp) (forward-char)))
  
- 
  ;; cleaning of old temp files
  (mapc 'delete-file
        (directory-files (thumbs-temp-dir) t thumbs-temp-prefix))
--- 641,649 ----
      (setq thumbs-marked-list (delete elt thumbs-marked-list))
      (let ((inhibit-read-only t))
        (delete-char 1)
!       (thumbs-insert-thumb elt nil)))
    (when (eolp) (forward-char)))
  
  ;; cleaning of old temp files
  (mapc 'delete-file
        (directory-files (thumbs-temp-dir) t thumbs-temp-prefix))
***************
*** 653,666 ****
    (interactive "sAction: \nsValue: ")
    (let* ((buffer-read-only nil)
  	 (old thumbs-current-tmp-filename)
! 	 (tmp (thumbs-temp-file)))
      (erase-buffer)
      (thumbs-call-convert (or old thumbs-current-image-filename)
  			 tmp
  			 action
  			 (or arg ""))
      (save-excursion
!       (thumbs-insert-image tmp 'jpeg 0))
      (setq thumbs-current-tmp-filename tmp)))
  
  (defun thumbs-emboss-image (emboss)
--- 656,670 ----
    (interactive "sAction: \nsValue: ")
    (let* ((buffer-read-only nil)
  	 (old thumbs-current-tmp-filename)
! 	 (type (thumbs-image-thumb-type thumbs-current-image-filename))
! 	 (tmp (concat (thumbs-temp-file) (symbol-name type))))
      (erase-buffer)
      (thumbs-call-convert (or old thumbs-current-image-filename)
  			 tmp
  			 action
  			 (or arg ""))
      (save-excursion
!       (thumbs-insert-image tmp type 0))
      (setq thumbs-current-tmp-filename tmp)))
  
  (defun thumbs-emboss-image (emboss)

^ permalink raw reply	[flat|nested] 101+ messages in thread

end of thread, other threads:[~2006-02-13 17:57 UTC | newest]

Thread overview: 101+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-29 13:57 thumbs.el and transparency Xavier Maillard
2006-01-29 20:14 ` Nick Roberts
2006-01-29 22:11   ` Mathias Dahl
  -- strict thread matches above, loose matches on Subject: below --
2006-01-25  1:08 Nick Roberts
2006-01-25  7:59 ` Juri Linkov
2006-01-25  9:20   ` Nick Roberts
2006-01-26 18:54     ` Mathias Dahl
2006-01-26 21:59       ` Nick Roberts
2006-01-27  3:46         ` Miles Bader
2006-01-27  9:27           ` Nick Roberts
2006-01-28  4:50             ` Richard M. Stallman
2006-01-28 23:58               ` Nick Roberts
2006-01-29 13:41                 ` Mathias Dahl
2006-01-29 21:10                   ` Nick Roberts
2006-01-29 22:42                     ` Mathias Dahl
2006-01-30 10:26                 ` Kim F. Storm
2006-01-30 11:23                   ` Juanma Barranquero
2006-01-30 15:12                     ` Chong Yidong
2006-01-30 15:41                       ` Juanma Barranquero
2006-01-30 18:43                         ` Chong Yidong
2006-01-31 18:04                         ` Richard M. Stallman
2006-01-31 19:47                           ` Juanma Barranquero
2006-01-31 21:10                             ` Luc Teirlinck
2006-01-31 23:08                               ` Kim F. Storm
2006-01-31 23:45                                 ` Luc Teirlinck
2006-02-01 10:41                                   ` Kim F. Storm
2006-02-02  2:07                                     ` Luc Teirlinck
2006-02-02  9:26                                       ` Juanma Barranquero
2006-02-02  9:35                                       ` Kim F. Storm
2006-01-31 23:54                                 ` Luc Teirlinck
2006-02-01 10:45                                 ` Juanma Barranquero
2006-01-30 23:25                     ` Richard M. Stallman
2006-01-31  9:26                       ` Juanma Barranquero
2006-01-29  9:38               ` Sascha Wilde
2006-01-29 13:46                 ` Mathias Dahl
2006-01-29 16:38                   ` Miles Bader
2006-01-29 18:13                     ` David Kastrup
2006-01-29 22:35                     ` Mathias Dahl
2006-01-29 16:50                   ` David Kastrup
2006-01-29 22:33                     ` Mathias Dahl
2006-01-27 16:53           ` Mathias Dahl
2006-01-29  0:03             ` Nick Roberts
2006-01-30  0:56               ` Richard M. Stallman
2006-01-30 11:35                 ` Mathias Dahl
2006-01-29  2:33             ` Miles Bader
2006-01-29 14:07               ` Mathias Dahl
2006-01-29 14:34               ` Mathias Dahl
2006-01-29 16:22             ` Robert J. Chassell
2006-01-29 18:01               ` Chong Yidong
2006-01-29 20:13               ` Nick Roberts
2006-01-30  1:04                 ` Robert J. Chassell
2006-01-30  2:08                   ` Nick Roberts
2006-01-30 14:44                     ` Robert J. Chassell
2006-01-29 22:04               ` Mathias Dahl
2006-01-29 23:13                 ` Chong Yidong
2006-01-30 11:57                   ` Mathias Dahl
2006-01-30 14:18                   ` Mathias Dahl
2006-01-30  1:49                 ` Robert J. Chassell
2006-01-30 12:08                   ` Mathias Dahl
2006-01-28  4:51           ` Richard M. Stallman
2006-01-29 16:01             ` Mathias Dahl
2006-01-30 18:46               ` Richard M. Stallman
2006-01-30 21:49                 ` Mathias Dahl
2006-01-30 22:16                   ` Mathias Dahl
2006-01-31 18:03                   ` Richard M. Stallman
2006-02-01 10:44                     ` Mathias Dahl
2006-02-02  4:16                       ` Richard M. Stallman
2006-02-02 16:34                         ` Mathias Dahl
2006-02-04 18:27                           ` Richard M. Stallman
2006-02-05 12:03                             ` Mathias Dahl
2006-02-05 20:36                               ` Juri Linkov
2006-02-05 22:05                                 ` Mathias Dahl
2006-02-06  0:22                                   ` Miles Bader
2006-02-06  7:27                                     ` Juri Linkov
2006-02-06 17:37                                     ` Mathias Dahl
2006-02-07 10:59                                       ` Juri Linkov
2006-02-07 17:46                                         ` Mathias Dahl
2006-02-08  9:17                                           ` Juri Linkov
2006-02-08 15:27                                             ` Mathias Dahl
2006-02-09 17:29                                               ` Juri Linkov
2006-02-09 22:46                                                 ` Mathias Dahl
2006-02-10  1:29                                                   ` Juri Linkov
2006-02-10 10:14                                                     ` Mathias Dahl
2006-02-10 10:28                                                       ` Miles Bader
2006-02-11 16:45                                                     ` Richard M. Stallman
2006-02-09 23:47                                                 ` Miles Bader
2006-02-10 10:12                                                   ` Mathias Dahl
2006-02-10 23:02                                                 ` Richard M. Stallman
2006-02-10 23:56                                                   ` Mathias Dahl
2006-02-11  1:21                                                     ` Juri Linkov
2006-02-11  9:30                                                       ` Mathias Dahl
2006-02-12 17:45                                                         ` Juri Linkov
2006-02-12 18:35                                                           ` Mathias Dahl
2006-02-12  4:30                                                     ` Richard M. Stallman
2006-02-12 14:38                                                       ` Mattis
2006-02-12 17:47                                                         ` Juri Linkov
2006-02-12 18:39                                                           ` Mathias Dahl
2006-02-13 17:57                                                             ` Juri Linkov
2006-02-06  2:06                               ` Richard M. Stallman
2006-01-27  4:12         ` Miles Bader
2006-01-27  4:50           ` Nick Roberts

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.