Gallery Macro vs. Image Macro

Hello! :waving_hand:

I’m trying to understand why the gallery macro displays images in better quality than the image macro.

With the image macro, I need to take the screenshots with the browser window resized (using the Inspect Element) to match the width corresponding to the size parameter to avoid quality loss. But taking the screenshot in a width corresponding to the size parameter changes the page layout (most of the times) because of responsiveness. One problem is that this can confuse readers who compare the documentation with their own wiki (especially in another language) and expect the layout to match.

The gallery macro doesn’t have this issue: it doesn’t require a size parameter, and it fills the background around the image, keeping the quality and layout stable. So I want to understand why there is such a difference in image quality between the two macros.

I’m putting the examples directly in a wiki page to avoid taking screenshots of screenshots. Examples illustrating the cases: Quality of images using “Image” Macro vs “Gallery” Macro.

I’m looking for feedback and ideas on this topic. Thanks!

I think that’s because the gallery macro uses the browser to resize the image while the image macro uses the XWiki Syntax, see https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/?syntax=2.1&section=Images . For example: [[image:img.png||width="25" height="25"]].

And the XWiki Syntax does a server-side resizing which uses some less good algorithm.

I don’t know enough though to suggest how to improve the server-size resizing.

Note that I think it would be easy to update the image macro used on xwiki.org to use browser image resizing instead of the XWiki Syntax.

Done, see https://www.xwiki.org/xwiki/bin/view/Macros/ImageMacro?viewer=changes&rev1=25.2&rev2=25.4&

1 Like

PS: please delete the draft page so that there’s no leftover. That’s why it’s better to put the screenshots in the forum post and not elsewhere. Now your post will have some broken links :wink:

Thanks! The images are indeed rendered with better quality now.
Deleting the draft as well. I wanted to avoid taking screenshots of screenshots that could cause loosing even more quality.

Better fix (thx to @MichaelHamann ):slight_smile:

https://www.xwiki.org/xwiki/bin/view/Macros/ImageMacro?viewer=changes&rev1=26.1&rev2=26.2&

1 Like