[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thumbs.el and transparency
From: |
Juri Linkov |
Subject: |
Re: thumbs.el and transparency |
Date: |
Sun, 05 Feb 2006 22:36:29 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
> I would like to have some feedback on the changes, but it seems I won't
> get some, so I better test some more myself first.
Well, the basic thing both thumbs packages are still missing is proper
integration with dired. The first thing I expect from a thumbs package
is to display a dired buffer with thumbnail images in it.
This can be very easily done with iimage.el, i.e. just open a dired buffer
and type M-x iimage-mode RET and you will see, for example:

This doesn't look right yet. With a simple fix it could preserve file
names in the dired buffer:
--- lisp/iimage.el 6 Aug 2005 22:13:43 -0000 1.6
+++ lisp/iimage.el 5 Feb 2006 20:28:32 -0000
@@ -133,12 +133,43 @@
- (add-text-properties (match-beginning 0) (match-end 0)
- (list 'display (create-image file)))
- (remove-text-properties (match-beginning 0) (match-end 0)
- '(display)))))))
+ (let ((ov (make-overlay (match-beginning 0) (match-end 0))))
+ (overlay-put ov 'evaporate t)
+ (overlay-put ov 'before-string
+ (propertize " "
+ 'display
+ (create-image file))))
+ (remove-overlays (match-beginning 0) (match-end 0)
+ 'display))))))
After that, images get added before the file name part in the dired
buffer like:

This is much better, but still doesn't work for large images. This can be
improved with another fix:
--- lisp/iimage.el 6 Aug 2005 22:13:43 -0000 1.6
+++ lisp/iimage.el 5 Feb 2006 20:29:32 -0000
@@ -133,1 +133,1 @@
- (create-image file))))
+ (create-image (my-make-thumbnail file)))))
and a new function:
(defun my-make-thumbnail (file)
(let* ((image-file (concat "file://" (expand-file-name file)))
(thumb-file (expand-file-name (concat "~/.thumbnails/normal/" (md5
image-file) ".png")))
(file-attrs (file-attributes file))
(modif-time (float-time (nth 5 file-attrs))))
(unless (file-exists-p thumb-file)
(shell-command
(mapconcat
'identity
(list
"convert"
(format "\"%s\"" file)
(format "-set \"Description\" \"Thumbnail of %s\"" image-file)
(format "-set \"Software\" \"ImageMagick, GNU Emacs %s\""
emacs-version)
(format "-set \"Thumb::URI\" \"%s\"" image-file)
(format "-set \"Thumb::MTime\" \"%.0f\"" modif-time)
"-set \"Thumb::Size\" \"%b\""
"-set \"Thumb::Image::Width\" \"%w\""
"-set \"Thumb::Image::Height\" \"%h\""
"-set \"Thumb::Image::Mimetype\" \"image/jpeg\""
"-resize 128x128"
"+profile \"*\""
"-type TrueColorMatte"
(format "png:\"%s\"" thumb-file))
" ")))
thumb-file))
This function generates thumbnail files exactly as specified by the
Thumbnail Managing Standard. It constructs the thumbnail filename,
fills all required attributes, resizes the image, removes EXIF data
and uses -type TrueColorMatte to force the encoder to write an
alpha channel as specified by the standard. I think this function
should be adopted for all Emacs thumbnail packages.
Given that, the result on large files will look like:

Isn't this nice? I think it is.
This is just one thing that would make Emacs thumbnail packages
more useful.
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/01
- Re: thumbs.el and transparency, Richard M. Stallman, 2006/02/01
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/02
- Re: thumbs.el and transparency, Richard M. Stallman, 2006/02/04
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/05
- Re: thumbs.el and transparency,
Juri Linkov <=
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/05
- Re: thumbs.el and transparency, Miles Bader, 2006/02/05
- Re: thumbs.el and transparency, Juri Linkov, 2006/02/06
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/06
- Re: thumbs.el and transparency, Juri Linkov, 2006/02/07
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/07
- Re: thumbs.el and transparency, Juri Linkov, 2006/02/08
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/08
- Re: thumbs.el and transparency, Juri Linkov, 2006/02/09
- Re: thumbs.el and transparency, Mathias Dahl, 2006/02/09