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