1 [[!template id=gitbranch branch=chrysn/imgforpdf author="[[chrysn]]"]]
3 when using the [[img plugin|plugins/img]] with an svg file, it is supposed to
4 convert it into a png for display in all browsers, and because the typical use
5 case is rendering small preview versions.
7 this currently doesn't work (at least with graphicsmagick-libmagick-dev-compat
8 1.3.18-1) due to the sequence imagemagick options are set, needs an extension
9 to work for pdfs (or any other imagemagick compatibile file) too, and should
10 have an additional parameter for page selection.
12 i've provided a series of [[!taglink patch]]es in the chrysn/imgforpdf [[git]]
15 i'd prefer to go a step further, and not only convert pdf and svg files to png,
16 but everything (with the possible exception of jpg files), as most other image
17 formats can't be displayed in a browser anyway -- but i didn't in this patch
18 series, as it would alter the file names of existing images, i don't know if
19 that needs special care or breaks something i don't use; this way, my patches
20 should be safe for inclusion.
24 > update 2014-06-29: the patch still applies and fixes the issue. in the
25 > meantime, i noticed that the desired effect doesn't happen when no explicit
26 > size is set. as scalable graphics don't necessarily have a natural size
27 > anyway, i don't consider that a showstopper. --[[chrysn]]
29 >> This all looks good in principle, but I would like to do a more detailed
30 >> review, and test it with "real ImageMagick" in case its behaviour differs
31 >> from GraphicsMagick.
33 >> An automated regression test for the desired behaviour in `t/` would
34 >> be great. There are SVGs and PNGs in the docwiki already; there are no
35 >> JPEGs or PDFs, but perhaps you could add a trivially small example
36 >> of each to `t/`? Imitating `t/tag.t` or `t/trail.t`, and skipping the
37 >> test if the required modules are missing like `t/podcast.t` does,
38 >> seems like it would work best.
40 >> I agree that everything not in an interoperable web format should be
41 >> converted to PNG when it's scaled down, but yes, that's more likely
42 >> to be a breaking change, so it seems best to do that as a separate
43 >> branch. In practice I think this means JPEG -> JPEG and everything
44 >> else -> PNG, since JPEG is commonly used for photos and photo-like
45 >> images that don't compress well under lossless compression. --[[smcv]]
47 >>> i've added a unit test and tested it with the [[!debsid perlmagick]]
48 >>> package, the [[!debsid graphicsmagick-libmagick-dev-compat]] package and
49 >>> the experimental [[!debpts libimage-magick-perl]] package (where the
50 >>> [[!debpts libmagickcore-6.q16-2-extra]] package is required too), in the
51 >>> meantime filing [[!debbug 753770]]. (why is it that it sometime seems i
52 >>> find more bugs in ikiwiki's dependencies than in itself when working with
55 >>> the unit test also checks for file removal when it is not created any more,
56 >>> which works, so my biggest fear about the all-to-png change is unwarranted.
57 >>> i'll have a look at that some time, but i think as things are, this is
58 >>> ready now, please review again. --[[chrysn]]
60 >>>> [[merged|done]] --[[smcv]]