Project

General

Profile

Actions

Feature #30492

closed

Replace RMagick with MiniMagick

Added by Go MAEDA almost 6 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gems support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Redmine uses ImageMagick via rmagick to generate thumbnails and gantt png export. I think it is beneficial to replace rmagick with minimagick for the following reasons:

  • Smaller footprint. The author says that the memory occupation is "much smaller compared to RMagick".
  • Supports the latest ImageMagick 7. rmagick does not yet.
  • Completely written in Ruby. Unlike rmagick, minimagick never causes build errors when installing the gem.

Files

30492-replace-with-minimagick.patch (17 KB) 30492-replace-with-minimagick.patch Yuichi HARADA, 2019-02-07 05:24
gantt_rmagick@2x.png (64.6 KB) gantt_rmagick@2x.png Yuichi HARADA, 2019-02-07 05:24
gantt_minimagick@2x.png (64.8 KB) gantt_minimagick@2x.png Yuichi HARADA, 2019-02-07 05:24
30492-v2.diff (59.6 KB) 30492-v2.diff Go MAEDA, 2019-08-13 10:52

Related issues

Related to Redmine - Feature #22995: Replace ImageMagick thumbnail creating with GD Graphics Library aka libgdNew

Actions
Related to Redmine - Patch #30821: Stay in RMagick 2.16.0 and don't update to 3.0.0ClosedGo MAEDA

Actions
Related to Redmine - Defect #34046: Escaping symbols in task subject can broke export to Gantt (PNG)Needs feedback

Actions
Related to Redmine - Defect #38728: Correctly escape issue text in Gantt PNG export for ImageMagick convertClosedGo MAEDA

Actions
Blocked by Redmine - Patch #31877: Update rbpdf (~> 1.20.0)ClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA almost 6 years ago

  • Related to Feature #22995: Replace ImageMagick thumbnail creating with GD Graphics Library aka libgd added
Actions #2

Updated by Yuichi HARADA almost 6 years ago

Go MAEDA wrote:

Redmine uses ImageMagick via rmagick to generate thumbnails and gantt png export.

Redmine does not use rmagick to generate thumbnails, but it directly executes the ImageMagick convert command.

rmagick is using only Redmine::Helpers::Gantt#to_image . This method is called when gantt png export.
I replaced rmagick with minimagick. I attached a patch.

  • gantt png export with rmagick.
  • gantt png export with minimagick. (Today's red line is different as we export it with rmagick and export it with minimagick the next day.)
Actions #3

Updated by Anonymous almost 6 years ago

Definitely +1 if it takes less memory :)

But I also wanted to take a look into doing all the image processing and saving stuff on the front end instead. Now that you can create canvas objects with 2d and webgl contexts as variables of javascript, it makes all these image generation and manipulations super easy even on the front end and thus there is little to no reason to bother a server with image processing. These tools already integrated in browsers (even IE11), require no libraries at all and definitely should be used. Imho server should just supply the required links to resources, JS should pick it up to process and store the processed into cache to request next time from the cache instead of resizing all the time (for best optimization).

And that would also be -1 back-end dependency.

Actions #4

Updated by Go MAEDA almost 6 years ago

Max Johansson wrote:

But I also wanted to take a look into doing all the image processing and saving stuff on the front end instead. Now that you can create canvas objects with 2d and webgl contexts as variables of javascript, it makes all these image generation and manipulations super easy even on the front end and thus there is little to no reason to bother a server with image processing. These tools already integrated in browsers (even IE11), require no libraries at all and definitely should be used. Imho server should just supply the required links to resources, JS should pick it up to process and store the processed into cache to request next time from the cache instead of resizing all the time (for best optimization).

Do you mean that the patch should not be committed and we should wait for someone to submit a JavaScript-based patch?

Generating gantt PNG images with JavaScript is a nice option but I think it is better to go with mini_magic for now because no one is currently working on JavaScirpt-based gantt export. This mini-magick-based patch can be delivered in 4.1.0, but no one knows when a JavaScript-based patch will be submitted. Of course, it is really nice if someone submits a JavaScript-based patch in the future.

Actions #5

Updated by Bernhard Rohloff almost 6 years ago

I also agree to commit this patch as we don't have a working JS alternative by now and it will definitely take it's time to develop and test it. In the meantime it's a nice improvement.
+1

Actions #6

Updated by Marius BĂLTEANU almost 6 years ago

Go, Bernhard, should we run some tests with both libraries (with new version of rmagick)? Also, I'm observing that rmagick is going to release a new version soon with a lot of refactoring and has new maintainers.

According to Travis, minimagick doesn't run the tests on ruby 2.6, should we create a PR before changing to it?

Actions #7

Updated by Anonymous almost 6 years ago

Go, sorry, I meant, I totally agree with committing the change to mini magic for now as current solution, I just wanted to also inform that this could definitely be improved even more in the future by trying out JS. I have other things at the moment, but surely, I'll take a look at it in the future. :)

Actions #8

Updated by Go MAEDA almost 6 years ago

  • Related to Patch #30821: Stay in RMagick 2.16.0 and don't update to 3.0.0 added
Actions #9

Updated by Go MAEDA almost 6 years ago

RMagick 3.0.0 has released on 2019-02-16 but it does not support ImageMagick 7.0 yet. In addition, it narrowed the supported version. The minimum supported version of ImageMagick has raised from 6.4.9 to 6.8.9.

Actions #10

Updated by Go MAEDA almost 6 years ago

  • Target version set to Candidate for next major release
Actions #11

Updated by Go MAEDA almost 6 years ago

  • Description updated (diff)
Actions #12

Updated by Go MAEDA over 5 years ago

Marius BALTEANU wrote:

According to Travis, minimagick doesn't run the tests on ruby 2.6, should we create a PR before changing to it?

I have just sent a pull request.
https://github.com/minimagick/minimagick/pull/475

Actions #13

Updated by Goh Matsumoto over 5 years ago

RMagick 3.0.0 has released on 2019-02-16 but it does not support ImageMagick 7.0 yet. In addition, it narrowed the supported version. The minimum supported version of ImageMagick has raised from 6.4.9 to 6.8.9.

I don't oppose replacing rmagick with minimagick.
But It seems that this isn't quite persuasive enough.

As described in the comment, ImageMagick 6.8.9 was released at nearly 4 years ago.
https://github.com/rmagick/rmagick/issues/392#issuecomment-466100509

And Redmine 3.4.0 released 2 years ago.
Do you think Redmine has to work with ImageMagick 6.8.8 or former?

Actions #14

Updated by Go MAEDA over 5 years ago

Goh Matsumoto wrote:

Do you think Redmine has to work with ImageMagick 6.8.8 or former?

Yes, I think so because some major Linux distributions still bundle older ImageMagick. For example, CentOS 7.6 and Amazon Linux AMI 2018.03 bundles ImageMagick 6.7.8.9.

You cannot install Redmine on such distributions without a trick like "bundle install --without rmagick". But I think it is difficult for admins who are not familiar with Ruby to find the solution. The installation process should be as simple as possible.

Actions #15

Updated by Marius BĂLTEANU over 5 years ago

Rails 6 is deprecating the MiniMagick backend and replacing the library with ImageProcessing gem. More details can be found in the Changelog.

Actions #16

Updated by Go MAEDA over 5 years ago

Marius BALTEANU wrote:

Rails 6 is deprecating the MiniMagick backend and replacing the library with ImageProcessing gem. More details can be found in the Changelog.

I didn't know that. Thanks.

Although Rails 6 does not directly depend on mini_magick, image_processing gem seems to require mini_magick. Please see: https://rubygems.org/gems/image_processing/versions/1.8.0

Maybe the change in Rails adds image_processing as a wrapper for libvips or mini_magick.

Actions #17

Updated by Ronan Chagas over 5 years ago

Goh Matsumoto wrote:

I don't oppose replacing rmagick with minimagick.
But It seems that this isn't quite persuasive enough.

Some distributions, like openSUSE Leap 15.0, does not ship ImageMagick 6 anymore. Currently, there is no official way to install ImageMagick 6 on Leap 15.0, 15.1, and Tumbleweed. Hence, it is not possible to install Redmine with `rmagick` since it won't build against ImageMagick 7.

EDIT: By the way, this patch is working perfectly and, even installing ImageMagick6 in openSUSE (latest version), I am getting and error when exporting Gantt to PNG.

Actions #18

Updated by Jun NAITOH over 5 years ago

Go MAEDA wrote:

Goh Matsumoto wrote:

Do you think Redmine has to work with ImageMagick 6.8.8 or former?

Yes, I think so because some major Linux distributions still bundle older ImageMagick. For example, CentOS 7.6 and Amazon Linux AMI 2018.03 bundles ImageMagick 6.7.8.9.

You cannot install Redmine on such distributions without a trick like "bundle install --without rmagick". But I think it is difficult for admins who are not familiar with Ruby to find the solution. The installation process should be as simple as possible.

rmagick 3.1.0 seems to extend the range of support for ImageMagick.

ImageMagick 6.7.7 or later

Actions #19

Updated by Jun NAITOH over 5 years ago

Redmine's PDF output feature uses the rbpdf library, now.
The image processing of the rbpdf library has parts depending on RMagick.
If Redmine migrates to minimagick, (and in environments where RMagick is not installed), PDF will not display images other than 8bit PNG (GIF, JPEG, non 8bit PNG).

Actions #20

Updated by Go MAEDA over 5 years ago

Jun NAITOH wrote:

Redmine's PDF output feature uses the rbpdf library, now.
The image processing of the rbpdf library has parts depending on RMagick.
If Redmine migrates to minimagick, (and in environments where RMagick is not installed), PDF will not display images other than 8bit PNG (GIF, JPEG, non 8bit PNG).

Thank you for pointing it out. I didn't know that the PDF export feature depends on RMagick.

I have changed my mind by knowing that. We had better not to commit the patch for now because replacing RMagick with MiniMagick because may break the PDF export feature.

Actions #21

Updated by Go MAEDA over 5 years ago

  • Category changed from Attachments to Gems support
Actions #22

Updated by Richard Hafenscher over 5 years ago

Ronan Chagas wrote:

Goh Matsumoto wrote:
EDIT: By the way, this patch is working perfectly and, even installing ImageMagick6 in openSUSE (latest version), I am getting and error when exporting Gantt to PNG.

I just got rmagick 2.16.0 with ImageMagic 6.8.8.1 running on OpenSUSE Leap 15.1 by installing these packets (most of theme from the Leap 42.3 repository):
ImageMagick-6.8.8.1-82.1.x86_64.rpm
ImageMagick-config-6-SUSE-6.8.8.1-82.1.x86_64.rpm
ImageMagick-devel-6.8.8.1-82.1.x86_64.rpm
libIlmImf-Imf_2_1-21-2.1.0-10.3.1.x86_64.rpm
libMagick++-6_Q16-3-6.8.8.1-82.1.x86_64.rpm
libMagickCore-6_Q16-1-6.8.8.1-82.1.x86_64.rpm
libMagick++-devel-6.8.8.1-82.1.x86_64.rpm
libMagickWand-6_Q16-1-6.8.8.1-82.1.x86_64.rpm
libwebp5-0.4.3-9.3.x86_64.rpm

The Gantt PNG export works now.

Actions #23

Updated by Jun NAITOH over 5 years ago

Go MAEDA wrote:

Thank you for pointing it out. I didn't know that the PDF export feature depends on RMagick.

I have changed my mind by knowing that. We had better not to commit the patch for now because replacing RMagick with MiniMagick because may break the PDF export feature.

rbpdf 1.20.0 has been released.
The following support was added.
  • Compatible with RMagick 4.0.
  • Added MiniMagick support. (MiniMagick can be used as an alternative to RMagick.)
Actions #24

Updated by Go MAEDA over 5 years ago

  • Target version changed from Candidate for next major release to 4.1.0

Jun NAITOH wrote:

rbpdf 1.20.0 has been released.
The following support was added.
  • Compatible with RMagick 4.0.
  • Added MiniMagick support. (MiniMagick can be used as an alternative to RMagick.)

Great!

I would like to propose to switch to MiniMagick again. I am sure that moving to MiniMagick will make Redmine installation easier.

Actions #25

Updated by Go MAEDA over 5 years ago

Actions #26

Updated by Go MAEDA over 5 years ago

Updated the patch for the current trunk (r18353).

Actions #27

Updated by Go MAEDA over 5 years ago

  • Subject changed from Replace rmagick with minimagick to Replace RMagick with MiniMagick
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you for your contribution.

Actions #28

Updated by Robert Schneider almost 5 years ago

If one could update the wiki regarding installation and upgrade, please. Are the devel packages of Image/GraphicsMagick required? Is there anything special to keep in mind on upgrade? I do not know enough about Ruby stuff.

Actions #29

Updated by Deoren Moor almost 5 years ago

Robert Schneider wrote:

If one could update the wiki regarding installation and upgrade, please. Are the devel packages of Image/GraphicsMagick required? Is there anything special to keep in mind on upgrade? I do not know enough about Ruby stuff.

This was confusing to me as well. Reading the official install/upgrade docs, it appears those packages are required, but looking at the discussion here I get the impression that they're not.

Actions #30

Updated by Go MAEDA about 4 years ago

  • Related to Defect #34046: Escaping symbols in task subject can broke export to Gantt (PNG) added
Actions #31

Updated by Go MAEDA about 1 year ago

  • Related to Defect #38728: Correctly escape issue text in Gantt PNG export for ImageMagick convert added
Actions

Also available in: Atom PDF