1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
* README for the ImageMagick Emacs branch
This is the imagemagick branch of Emacs. Imagemagick can now be used
to load many new image formats, and also do useful transforms like
scaling and rotation.
This file will attempt to contain draft NEWS, Changelog and manual
entries for the new functionality.
You might need to regenerate the configure scripts:
aclocal
automake
autoheader
autoconf
./configure --with-imagemagick
* TODO image-type-header-regexps priorities the jpeg loader over the
imagemagick one. This is not wrong, but how should a user go about
prefering the imagemagick loader? The user might like zooming etc in
jpegs.
try (setq image-type-header-regexps nil) for a quick hack to prefer
imagemagick over the jpg loader.
* TODO For some reason its unbearably slow to look at a page in a large
image bundle using the :index feature. The imagemagick "display"
command is also a bit slow, but nowhere near as slow as the emacs
code. It seems imagemagick tries to unpack every page when loading
the bundle. This feature is not the primary usecase for the
imagemagick patch though.
ImageMagick 6.6.2-9 introduced a bugfix for single page djvu load.
It is now way faster to use the :index feature, but its still not
very fast.
** DONE optimize number of pages calculation for bundles as suggested by
imagemagick forum: "set the density to something low like 2 and use
MagickPingImage()"
** TODO try to cache the num pages calculation. it can take a while to
calculate the number of pages, and if you need to do it for each
page view, page-flipping becomes uselessly slow.
* TODO integrate with image-dired
* TODO integrate with docview.
* TODO integrate with image-mode
Some work has been done, M-x image-transform-fit-to-height will fit
the image to the height of the Emacs window for instance.
* TODO look for optimizations for handling images with low depth
Currently the code seems to default to 24 bit RGB which is costly for
images with lower bit depth.
* TODO complete documentation drafts below
* DONE fix inconsistencys with spelling of imagemagick in the src
* DONE report number of images in image bundle types somehow
Works like for "gif" support. Thanks to Juri Linkov.
* DONE probably add pdf to inhibited types
* DONE inhibit types is defconst should probably be defcustom
* TODO decide what to do with some uncommitted imagemagick support
functions for image size etc.
* TODO Test with more systems
Tested on Fedora 12 so far, and the libmagick that ships with it.
Ubuntu 8.04 was also tested, but it seems it ships a broken
ImageMagick.
I also tried using an imagemagick compiled from their SVN, in
parallell with the one packaged by Fedora, it worked well.
* DONE Also need some way to handle render methods that only work on newer ImageMagicks
Is handled by configure now
* Some nits from Stefan Monnier
I just took a quick look at the code and I see the following nits to fix:
** TODO obviously a merge will have to come with a good ChangeLog.
** DONE also the merge will need to come with documentation. Maybe not in the
Texinfo form yet, but at least in the etc/NEWS with enough info that
describes the `scale' and other such arguments that someone can start
using them.
** DONE the README talks about naming inconsistencies, I think these should be
fixed before a first commit (should be straightforward).
** DONE the "let" in image.el should not be followed by a line break and the while
should be replaced by a dolist.
** DONE the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]])
its args, not sure what happened.
** DONE a few lines in the C code break the 80columns limit.
** DONE please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]])
** DONE you can get rid of the prototypes by reordering the code. ([[2010.06.14]])
** DONE the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]])
weirdly otherwise in C-h f).
** DONE Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]])
** DONE why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]])
** DONE some "," lack a space after them. ([[2010.06.14]])
** DONE several "=" and "==" lack spaces around them. ([[2010.06.14]])
* NEWS entry
** ImageMagick support
It is now possible to use the Imagemagick library to load many new
image formats in Emacs.
To enable, use the following configure option:
--with-imagemagick
The new function (imagemagick-types) returns a list of image file
extensions that your installation of imagemagick supports.
The function (imagemagick-register-types) will enable the imagemagick
support for the extensions in imagemagick-types minus the types listed
in imagemagick-types-inhibit.
imagemagick-types-inhibit has the value '(C HTML HTM TXT PDF) by default.
This means imagemagick will be used also to load jpeg files, if you
have both jpeg and imagemagick libraries linked. Add 'JPG to
imagemagick-types-inhibit if you do not want this.
imagemagick-render-type is a new variable which can be set to choose
between screen render methods.
- 0 is a conservative metod which works with older ImageMagick
versions. It is a bit slow, but robust.
- 1 utilizes a newer ImageMagick method
Images loaded with imagemagick will support a couple of new display
specification behaviours:
- if the :width and :height keywords are specified, these values are
used for scaling the image. If only one of :width or :height is
specified, the other one will be calculated so as to preserve the
aspect ratio.If both :width and :height are specified, aspect ratio
will not be preserved.
- :rotation specifies a rotation angle in degrees.
- :index specifies which image inside an image bundle file format, such
as TIFF or DJVM, to view.
The image-metadata function can be used to retrieve the total number
of images in an image bundle. This is simmilar to how GIF files work.
* Changelog entry
2010-06-12 Joakim Verona <joakim@verona.se>
* image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is
defined:
(imagemagick_image_p): New function to test for ImageMagic img.
(imagemagick_load): New function to load ImageMagick img.
(imagemagick_load_image): New function, helper for imagemagick_load
(imagemagick-types): New function.
(Qimagemagick): New Lisp_object.
* image.el:
(imagemagick-types-inhibit): New var.
(imagemagick-register-types): New function.
* config.in, Makefile.in, configure.in
* Manual entry
nothing yet, but the NEWS entry could be adapted.
|