Open grignards opened 3 years ago
Converting the same directly
, its about creating PNG first and JPEG at end with convert-resize ?* Do we have an idea why we create png and after jpeg file and not directly the jpeg file ?
I think it all comes down to successive changes + a specific background management in ImagePreviewBuildPillow
that could be easily replicated with ImagePreviewBuildWand
.
* When you says `Converting the same directly`, its about creating PNG first and JPEG at end with convert-resize ?
No, without creating the PNG image (so with a command like convert original.jpg -resize 100x100 preview.jpg
). Its the PNG image creation which is slow, encoding a PNG is not designed for speed.
The right way to fix this would be to implement another builder which avoid this intermediate file and/or change priority in builders.
In fact there are 3 builders for images, and after a first look at it I think we could keep only one, ImagePreviewBuildWand
as it seems to be able to support all the functionalities we need (background + currently supported file formats).
When all its dependencies are installed preview generator uses the
ImagePreviewBuilderIMConvert
builder. This builder then creates a temporary PNG image before giving it to theImagePreviewBuilderPillow
builder that converts the temporary png in jpeg. For a moderately sized image (around 8MB - 4000x2000 pixels) this takes 4-5 seconds. Converting the same directly withconvert -resize
does only take 0.6 seconds on the same computer.Computing a preview should take around the same time as directly using
convert
.