Menu

#438 t/241_threshold.t fails since imagemagick 7.1.2-5

v1.0_(example)
closed-fixed
nobody
None
5
2025-12-02
2025-10-25
pacien
No

This test seems to fail since imagemagick 7.1.2-5.
It was passing with imagemagick 7.1.2-3.
(note: 7.1.2-4 seems to have been retracted.)

I'm not sure whether it's an incompatibility in the libs or a regression in magick.

Gscan2pdf version 2.13.4, with Perl 5.40.0, on NixOS x86_64.

Full build and test log: https://cache.nixos.org/log/mi6mjsv5x861ki393lsy7skgm7kfaqlf-perl5.40.0-gscan2pdf-2.13.4.drv

Full list of dependencies and versions: https://hydra.nixos.org/build/309263493#tabs-build-deps

Test log snippet:

t/241_threshold.t ............................. 1/4 WARNING: The convert command is deprecated in IMv7, use "magick" instead of "convert" or "magick convert"

2025/10/10 13:18:41 Undefined units.
2025/10/10 13:18:41 The resolution and page size will probably be wrong.
t/241_threshold.t ............................. 4/4 
#   Failed test 'created valid PDF'
#   at t/241_threshold.t line 54.
#                   'Producer:        PDF::Builder 3.025 [see https://github.com/PhilterPaper/Perl-PDF-Builder/blob/master/INFO/SUPPORT]
# Custom Metadata: no
# Metadata Stream: no
# Tagged:          no
# UserProperties:  no
# Suspects:        no
# Form:            none
# JavaScript:      no
# Pages:           1
# Encrypted:       no
# Page size:       5040 x 3312 pts
# Page rot:        0
# File size:       4550 bytes
# Optimized:       no
# PDF version:     1.4
# '
#     doesn't match '(?^:Page size:\s+70 x 46 pts)'
# Looks like you failed 1 test of 4.
t/241_threshold.t ............................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests 

Discussion

  • Jeffrey Ratcliffe

    As imagemagick 7.1.2-5 is not yet in Debian testing, I can't easily reproduce this; so please test this patch, which I hope will fix it.

     
  • pacien

    pacien - 2025-10-26

    Thank you for the patch.
    Unfortunately, the same test failure persists with this patch and imagemagick 7.1.2-5.
    Full build and test log is attached.

     
  • Jeffrey Ratcliffe

    Thanks for the feedback. I missed a load of convert calls. Please try this new patch instead.

     
  • Jeffrey Ratcliffe

    I've successfully tested this last patch with imagemagick 7.1.2.7 from Debian sid.

     

    Last edit: Jeffrey Ratcliffe 2025-10-28
  • Jeffrey Ratcliffe

    I take it back. Must have been caching. With 7.1.2.7 from Debian sid, I can now reproduce the bug. I'll work on a fix now.

     
  • Jeffrey Ratcliffe

    This now works for me.

     
  • pacien

    pacien - 2025-11-01

    Thank you!
    I confirm that the latest patch solves the issue with t/241_threshold.t.

    I've just noticed that I had t/3722_user_defined.t disabled.
    This test contains one last call to the old "convert" command.

    I also have two other failures left in:

    • t/51_process_chain.t
    • t/53_process_chain.t

    Those two seem to be due to an OCR precision issue.
    I've updated Tesseract from 3.05.02 to 5.5.0, but the failure persists.
    Could this be due to a difference in default font?
    We're using the open-licenced Liberation TTF for the Nix package.

    Full log is attached.

     
  • Alistair

    Alistair - 2025-11-02

    I'm able to reproduce this result. To me, it looks a bit like the NixOS ImageMagick package has issues:

    Running the 51_process_chain.t magick command directly:

    $ magick 'label:The quick brown fox' -alpha Off -depth 1 -colorspace Gray -family 'DejaVu Sans' -pointsize 12 -density 300 -rotate 90 test.pnm
    magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1745.
    

    The same command succeeds on Ubuntu 24.04.

    FYI:

    $ fc-list : family
    FiraCode Nerd Font,FiraCode Nerd Font Ret
    TeX Gyre Pagella
    FiraCode Nerd Font Mono,FiraCode Nerd Font Mono SemBd
    FiraCode Nerd Font Propo
    DejaVu Math TeX Gyre
    FiraCode Nerd Font,FiraCode Nerd Font Light
    Adwaita Mono
    DroidSansM Nerd Font
    FiraCode Nerd Font,FiraCode Nerd Font Med
    FiraCode Nerd Font Propo,FiraCode Nerd Font Propo Med
    DejaVu Sans Mono
    TeX Gyre Heros Cn
    FiraCode Nerd Font
    Hack Nerd Font Propo
    TeX Gyre Cursor
    TeX Gyre Schola
    FreeSerif
    DejaVu Sans,DejaVu Sans Light
    FiraMono Nerd Font Mono
    FiraMono Nerd Font Propo
    DejaVu Sans
    DejaVu Serif,DejaVu Serif Condensed
    FiraCode Nerd Font Mono,FiraCode Nerd Font Mono Light
    FiraCode Nerd Font Mono
    FiraCode Nerd Font Mono,FiraCode Nerd Font Mono Med
    TeX Gyre Adventor
    DejaVu Sans,DejaVu Sans Condensed
    FiraMono Nerd Font Propo,FiraMono Nerd Font Propo Medium
    TeX Gyre Termes
    Liberation Mono
    FiraMono Nerd Font,FiraMono Nerd Font Medium
    Hack Nerd Font Mono
    DroidSansM Nerd Font Propo
    TeX Gyre Chorus
    FiraCode Nerd Font Propo,FiraCode Nerd Font Propo SemBd
    Hack Nerd Font
    Liberation Serif
    TeX Gyre Bonum
    Liberation Sans
    DroidSansM Nerd Font Mono
    FreeSans
    Fixed
    FiraCode Nerd Font,FiraCode Nerd Font SemBd
    Adwaita Sans
    FiraCode Nerd Font Propo,FiraCode Nerd Font Propo Ret
    Noto Color Emoji
    FiraMono Nerd Font Mono,FiraMono Nerd Font Mono Medium
    Unifont
    cursor.pcf
    FiraCode Nerd Font Mono,FiraCode Nerd Font Mono Ret
    FiraMono Nerd Font
    DejaVu Serif
    TeX Gyre Heros
    FreeMono
    FiraCode Nerd Font Propo,FiraCode Nerd Font Propo Light
    

    @pacien I'm getting:

    Your system does not have Image::PNG::Libpng installed, so some PNG functions may not run correctly.

    errors throughout the log, even though it is in the PERL5LIB path.

    If I attempt to run gscan2pdf it complains that ImageMagick isn't available:

    Warning: missing packages
    Save image and Save as PDF both require imagemagick
    
     
  • Jeffrey Ratcliffe

    I think that these last two failures might be subtle differences in imagemagick v6 & v7 again. I'm, travelling though so can't test my assumption.

    If someone could test this updated patch. I would be grateful.

     
  • Alistair

    Alistair - 2025-11-02

    Great! This builds without error.

    It still has the failure when running:

    Warning: missing packages
    Save image and Save as PDF both require imagemagick
    

    even though the log finds imagemagick:

    INFO - Found Image::Magick 7.1.2
    INFO - Found unpaper v7.0.0
    INFO - convert --version
    INFO - Spawned PID 45574
    INFO - Found imagemagick6 7.1.2-7
    INFO - magick --version
    INFO - Spawned PID 45575
    INFO - Found imagemagick7 7.1.2-7
    
     
  • Jeffrey Ratcliffe

    This updated patch fixes the gscan2pdf startup message issue

     
  • Alistair

    Alistair - 2025-11-02

    Thanks! I've now built, scanned and saved a document successfully.

    (including running tests t/169_import_scan.t and t/3722_user_defined.t, which were previously disabled on NixOS).

    And it's on ImageMagick 7.1.2-8.

     

    Last edit: Alistair 2025-11-02
  • pacien

    pacien - 2025-11-02

    I confirm that all tests are now passing with this latest patch.

    Is a new release planned soon, or
    should we go ahead and apply this patch ourselves in NixOS/nixpkgs?

     
  • Jeffrey Ratcliffe

    I'm travelling for a week, and the machine I'm writing this from is not yet set up for releases. I'll try and get a release out ASAP, but that might not be for a week.

     
  • pacien

    pacien - 2025-12-02

    Gscan2pdf has been updated to 2.13.5 on nixpkgs.
    Tests are passing and everything is working as expected.
    Thank you!

     
  • Jeffrey Ratcliffe

    • status: open --> closed-fixed
     

Log in to post a comment.