Defect #35027

Gantt PNG export ignores imagemagick_convert_command

Added by Go MAEDA over 1 year ago. Updated 10 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:


Target version:4.1.6
Resolution:Fixed Affected version:4.1.0


Gantt PNG export uses ImageMagick's convert command, but it ignores imagemagick_convert_command in configration.yml.

Steps to reproduce:

1. Set incorrect command name (e.g. /usr/bin/_convert) to imagemagick_convert_command in configration.yml
2. Restart Redmine
3. Export gantt to PNG. It should not work because imagemagick_convert_command is wrong, but it works fine.

35027.patch Magnifier (739 Bytes) Yuichi HARADA, 2021-04-19 04:29

Related issues

Related to Redmine - Defect #35424: Reopened

Associated revisions

Revision 21427
Added by Marius BALTEANU 10 months ago

Fix gantt PNG export ignores imagemagick_convert_command (#35027).

Patch by Yuichi HARADA.

Revision 21428
Added by Marius BALTEANU 10 months ago

Merged r21427 to 4.2-stable (#35027).

Revision 21429
Added by Marius BALTEANU 10 months ago

Merged r21427 to 4.1-stable (#35027).


#1 Updated by Yuichi HARADA over 1 year ago

It seems that you can set the path of Imagemagick's client command to MiniMagick.cli_path.

I created a patch.

diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 122013e5a..7d078298c 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -395,6 +395,9 @@ module Redmine
           Redmine::Configuration['minimagick_font_path'].presence ||
         img = MiniMagick::Image.create(".#{format}", false)
+        if Redmine::Configuration['imagemagick_convert_command'].present?
+          MiniMagick.cli_path = File.dirname(Redmine::Configuration['imagemagick_convert_command'])
+        end do |gc|
           gc.size('%dx%d' % [subject_width + g_width + 1, height])

#2 Updated by Marius BALTEANU over 1 year ago

  • Target version set to Candidate for next minor release

#3 Updated by Go MAEDA over 1 year ago

  • Duplicated by Defect #35424: added

#4 Updated by Jan Catrysse over 1 year ago

I tried this patch on #35424 but that did not fix the issue. Maybe something else is happening, but I'm not enough of a connoisseur :-)

#5 Updated by Go MAEDA 12 months ago

  • Target version changed from Candidate for next minor release to 4.1.6

Setting the target version to 4.1.6.

#6 Updated by Marius BALTEANU 10 months ago

  • Status changed from New to Resolved
  • Assignee set to Marius BALTEANU
  • Resolution set to Fixed

Patch committed, thanks!

The patch can fix some issues when the convert command is not available in the global path, but the binary always must be named convert.

Based on the example from #35424, setting imagemagick_convert_command: /usr/local/bin/convert will generate the following:
  • MiniMagick.cli_path (used for Gantt PNG) will be set to /usr/local/bin and MiniMagick will look after convert binary inside that path.
  • For thumbnail generation, it will be used the exact path from configuration: /usr/local/bin/convert.

In case of a different binary name (convert2 for example), the Gantt PNG will not work.

#7 Updated by Marius BALTEANU 10 months ago

  • Status changed from Resolved to Closed

#8 Updated by Marius BALTEANU 10 months ago

  • Duplicated by deleted (Defect #35424:

#9 Updated by Marius BALTEANU 10 months ago

  • Related to Defect #35424: added

Also available in: Atom PDF