algoo/preview-generator

Wand is used instead of preview_generator for png (and probably most image format)

inkhey opened this issue · 7 comments

Wand builder in 0.17+ version is used by default instead of the Imagemagick builder to generate png. This cause issue as the wand builder is not properly designed and don't produce good quality png image (black background, low quality image).

The issue was introduced here:
7e192da

The problem is related to the import line, which change the load ordering and make wand by used by default for png

from preview_generator.preview.builder.image__imconvert import ImagePreviewBuilderIMConvert

We should now deprecate wand builder and make it not registered by default, but for later, it may be very useful to have a way to force a strict order of builder, to avoid this kind of issue. There are other couple of builder which support same format like svg file (supported by both cairosvg and inkscape).

We should now deprecate wand builder and make it not registered by default

Not registering is not required to let image magick to be the default builder. Not registering Wand builder will potentially introduce regressions (in case some formats are supported by wand and not by image magick)

There are other couple of builder which support same format like svg file (supported by both cairosvg and inkscape).

This is not a problem: the support may be different and one be better in some cases and the other in other cases. The right thing to do for these cases is (for the future):

  • explicitly define load order
  • allow user to adjust the order

I think the right way to do so is to implement something like a priority weight which would be resolved at load time. This way, it also allows users to define there own builders.

We should now deprecate wand builder and make it not registered by default

Not registering is not required to let image magick to be the default builder. Not registering Wand builder will potentially introduce regressions (in case some formats are supported by wand and not by image magick)

As discussed with @lebouquetin , we will disabled wand builder by default, as the list of supported format are the same (to be more exact supported format by wand are contained in imagemagick supported format list) , so, there is no case where wand builder disabling will remove a supported format.

There are other couple of builder which support same format like svg file (supported by both cairosvg and inkscape).

This is not a problem: the support may be different and one be better in some cases and the other in other cases. The right thing to do for these cases is (for the future):

* explicitly define load order

* allow user to adjust the order

I think the right way to do so is to implement something like a priority weight which would be resolved at load time. This way, it also allows users to define there own builders.

Issue created there about this:#237

fixed in 0.21

a523 commented

Hi, @inkhey Can you elaborate on this? Or provide an example?This cause issue as the wand builder is not properly designed and don't produce good quality png image (black background, low quality image).
You know I want use wand instead of pillow to resize image in the end,so I would like to know what was the reason to disable the wand builder in the first place.

You know I want use wand instead of pillow to resize image in the end,so I would like to know what was the reason to disable the wand builder in the first place.

The reason of disabling it was because:

  • It does the same as the imagemagick command line but worst (the command line builder was already able to generate proper png using pillow).
  • We don't have much time to create a proper Wand builder, so we create this issue #253.
  • before introduction of ordering weight: #237 the ordering was not strictly etablished and slight change in code has change the builder used by default between ImageMagick command line (which give proper preview) and Wand, as a quick fix, we disable the wand builder (not well tested/supported), to ensure the correct builder (the imagemagick command line one) is used between the 2 imagemagick builders.