https://bugs.kde.org/show_bug.cgi?id=520803

            Bug ID: 520803
           Summary: BQM User Shell Script that invokes ImageMagick cannot
                    process JPEG images by default
    Classification: Applications
           Product: digikam
      Version First 9.1.0
       Reported In:
          Platform: Microsoft Windows
                OS: Microsoft Windows
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Plugin-Bqm-Script
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
When invoked in the context of a User Shell Script in the BQM on Windows,
ImageMagick cannot process JPEG images by default

STEPS TO REPRODUCE
1. Install DigiKam and ImageMagick (from `winget`, in my case)
2. Create a batch queue with a JPEG image
3. Assign the User Shell Script tool to the batch
4. Add the following script:
```
set
magick -list format
magick $INPUT -resize 64x64 $OUTPUT
```
4. Run the batch

EXPECTED RESULTS
1. The batch runs successfully
2. The output of the `set` command in the `digikam.dplugin.bqm: Script stdout`
line in DebugView includes no ImageMagick-specific environment variables
3. The output of the `magick -list format` command in the `digikam.dplugin.bqm:
Script stdout` line in DebugView includes JPEG as one of the supported formats
4. `digikam.dplugin.bqm: Script stderr ""` and `digikam.dplugin.bqm: Script
exit code: 0` appear in DebugView
5. A very small JPEG file is created

OBSERVED RESULTS
1. The batch fails with `User Script: Error code returned 1.` (among other
errors)
2. The output of the `set` command in the `digikam.dplugin.bqm: Script stdout`
line in DebugView shows that both `MAGICK_CODER_FILTER_PATH` and
`MAGICK_CODER_MODULE_PATH` environment variables are set to the DigiKam
executable path directory
3. The output of the `magick -list format` command in the `digikam.dplugin.bqm:
Script stdout` line in DebugView does *not* include JPEG as one of the
supported formats
4. ``digikam.dplugin.bqm: Script stderr "magick.exe: no decode delegate for
this image format `C:\\Users\\username\\Path To
Image\\BatchTool-GUXUJq-2fff5175.digikamtempfile.jpg' @
error/constitute.c/ReadImage/753.\r\n"`` and `digikam.dplugin.bqm: Script exit
code: 1` appear in DebugView
5. No very small JPEG file is created

ANALYSIS AND WORKAROUND
The cause of this bug appears to be that DigiKam (or at least the Windows
version of it) (a) doesn't include the ImageMagick module for handing JPEGs
(the `IM_MOD_RL_jpeg_.dll` was one of many ImageMagick libraries removed as
redundant from the Windows bundle in git commit
a29358b428e2ab2195d1a153268f12919971ff18, which predates the 8.2.0 tag) and (b)
enforces the use of DigiKam-provided ImageMagick modules by setting environment
variables which carry over into the environment used to execute user scripts.
As a workaround, appending the following to the beginning of the script above
produces the expected results:
```
set MAGICK_CODER_FILTER_PATH=
set MAGICK_CODER_MODULE_PATH=
```

SOFTWARE/OS VERSIONS
digiKam-9.1.0-20260527T090316-Qt6-Win64
Windows 11 Pro 24H2 v26100.8457

ADDITIONAL INFORMATION
I'm guessing that this bug is similar to #490524; I created a new bug here
because of (a) the significant redaction in that earlier bug report, (b) the
different platform affected, and (c) the earlier bug being marked as fixed
(which it might well have been for that platform).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to