Feature #12625

Make Ikiwiki resize images deterministically

Added by anonym 2017-05-31 16:05:49 . Updated 2017-10-02 13:02:52 .

Status:
Resolved
Priority:
Normal
Assignee:
intrigeri
Category:
Target version:
Start date:
2017-05-31
Due date:
% Done:

100%

Feature Branch:
Type of work:
Code
Blueprint:

Starter:
Affected tool:
Deliverable for:
289

Description

As seen in Bug #12566, if we do something like:

[[!img introduction_to_gnome_and_the_tails_desktop/keyboard.png size="267x" link="no" alt="Menu in the top-right corner of the desktop to switch between different keyboard layouts"]]


the resulting resized image contains a timestamp => breaks reproducibility.

Ikiwiki does the resizing in IkiWiki/Plugin/img.pm, using an interface to ImageMagick. I think Ikiwiki just have to tell PerlMagick to do the equivalent of convert +set date:create +set date:modify -define png:exclude-chunk=time to fix this.

The two +set ... things can be accomplished with:

--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -174,6 +174,9 @@ sub preprocess (@) {
                my $r = $im->Read("$format:$srcfile\[$pagenumber]");
                error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;

+                $im->Set('date:create' => NULL);
+                $im->Set('date:modify' => NULL);
+
                if (! defined $im->Get("width") || ! defined $im->Get("height")) {
                        error sprintf(gettext("failed to get dimensions of %s"), $file);
                }


but perhaps we only want to do this if SOURCE_DATE_EPOCH is set, and then set it to that value instead of NULL?

Note that we still may need to find how to tell PerlMagick to do -define png:exclude-chunk=time.


Subtasks


Related issues

Related to Tails - Bug #12566: ikiwiki image size specification makes the ISO build unreproducible Resolved 2017-05-19

History

#1 Updated by intrigeri 2017-05-31 16:17:42

#2 Updated by intrigeri 2017-05-31 16:17:57

  • related to Bug #12566: ikiwiki image size specification makes the ISO build unreproducible added

#3 Updated by intrigeri 2017-05-31 16:18:41

  • Target version set to Tails_3.2

#4 Updated by anonym 2017-05-31 17:22:37

  • Status changed from Confirmed to In Progress

Applied in changeset commit:14a77e5aeac81b9a51c1de1f0385c9a9073188a7.

#5 Updated by intrigeri 2017-06-14 19:22:49

  • Status changed from In Progress to Confirmed

#6 Updated by intrigeri 2017-09-01 16:36:48

anonym wrote:
> Note that we still may need to find how to tell PerlMagick to do -define png:exclude-chunk=time.

According to the doc, setting the option attribute with the Set method allows one to “associate an option with an image format (e.g. option=>‘ps:imagemask’”. I guess that’s what we want :)

#7 Updated by intrigeri 2017-09-01 19:40:57

  • Status changed from Confirmed to In Progress
  • Target version changed from Tails_3.2 to Tails_3.3
  • % Done changed from 0 to 50

Submitted merge request (with unit test included) upstream: https://ikiwiki.info/bugs/images_resizing_is_not_deterministic/. I’ll come back to it during the next cycle if it’s not merged yet. Note that our website does not expose this issue anymore, so wrt. SponsorT, having submitted a fix upstream is already pretty good.

#8 Updated by anonym 2017-09-07 10:12:01

intrigeri wrote:
> Submitted merge request (with unit test included) upstream: https://ikiwiki.info/bugs/images_resizing_is_not_deterministic/. I’ll come back to it during the next cycle if it’s not merged yet. Note that our website does not expose this issue anymore, so wrt. SponsorT, having submitted a fix upstream is already pretty good.

You rock! \o/

#9 Updated by intrigeri 2017-10-02 13:02:52

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100

Was merged upstream.