Project

General

Profile

Actions

Bug #14810

closed

im_negate_mask im_imvMaskState have no effect on combine test (bugfix included)

Added by old_elias1884 about 19 years ago. Updated almost 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Install Tool
Target version:
-
Start date:
2005-06-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.8.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

This report comes with a bugfix and a detailed investigation report of the problem. I spent several hours to find out, what was wrong. I finally found out what causes the inverted masks problems in 5+ versions.

As you can see in the man page of version 6.0.6 the source-file (base-file) and the overlay-file (change-file) traded places.

The man page states:
-----------------------
composite composites (combines) images to create new images.
base-image is the base image and change-image contains the changes. ouput-image is the result, and normally has the same dimensions as base-image.

The optional mask-image can be used to provide opacity information for change-image when it has none or if you want a different mask.
A mask image is typically grayscale and the same size as base-image. If mask-image is not grayscale, it is converted to grayscale and the resulting intensities are used as opacity information.
-----------------------

I spent a whole day investigating how several ImageMagick versions behave and I came to the conclusion, that as of version 5.2.6 (most likely 5.2.0) these two command arguments traded places and that's why version 5 of ImageMagick behaves so different. The ImageMagick hackers simply forgot to mention that in the documentation and just found out about their mistake while writing man pages for version 6. I was not able to test any versions prior to 5.2.0 and after 4.2.9, since they are not available on sourceforge anymore. I guess nobody uses them anymore anyway and perhaps they were considered alpha or unstable and that's why they are not there, since version 4.2.9 instead is still available for download.

I tested the following versions for this bug:
4.2.9, 5.2.6, 5.3.9, 5.4.9, 5.5.7 and 6.0.6
My test log of unchanged 3.8.0 is attached below.

The mask inversion way used right now would work when implemented properly. But the inversion was done in the functions that used imagemagick instead of in the imagemagick function itself, what lead to inconsistancy in the first place. That's why the combine test never worked eventhough the gd test, which also used imagemagick worked fine.

However, there is a much simpler solution the one I would considere the REAL solution. Since the problem is the fact that the order of the command arguments has changed, changing the arguments accordingly when IM5+ is around is the logical solution.

So I did some changes to:
class.t3lib_stdgraphic.php
to accomodate the new findings and clean up the file. I uploaded my diff.

With my patch, everything works in all the above versions!

I hope my findings get integrated in version 3.8.1 or 3.8.0.1 and hopefully they will be backported to 3.7.2 as well. The hack is simple and it should be no hazzle to integrate it. If you need any additional information please contact me at "elias (AT) asb (DASH) online (DOT) at". I would appreciate to hear from you whether you like my hack or not.

I am proud to be able to contribute to that great project finally!

elias

------------------------------------------
Test log of 3.8.0 unchanged behaviour.

ImageMagick (4.2.9)
usage: combine [ options ... ] image composite [ mask ] combined
$TYPO3_CONF_VARS["GFX"]["TTFdpi"] = '96'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_combine_filename"] = 'combine'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_path"] = '/usr/local/imagemagick-5.2.6/bin/'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_version_5"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_imvMaskState"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_negate_mask"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_no_effects"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_v5effects"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_mask_temp_ext_gif"] = '1'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["gdlib_2"] = '1'; // Modified or inserted by TYPO3 Install Tool.
-------------------

ImageMagick (5.2.6)
usage: combine [ options ... ] image composite [ mask ] combined
$TYPO3_CONF_VARS["GFX"]["TTFdpi"] = '96'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_combine_filename"] = 'combine'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_path"] = '/usr/local/imagemagick-5.2.6/bin/'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_version_5"] = '1'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_imvMaskState"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_negate_mask"] = '1'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_no_effects"] = '1'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_v5effects"] = '0'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["im_mask_temp_ext_gif"] = '1'; // Modified or inserted by TYPO3 Install Tool.
$TYPO3_CONF_VARS["GFX"]["gdlib_2"] = '1'; // Modified or inserted by TYPO3 Install Tool.

combine test inverted
gd test correct except no blury shadow

$TYPO3_CONF_VARS["GFX"]["im_v5effects"] = '1'; // Modified or inserted by TYPO3 Install Tool.
shadow is blury

$TYPO3_CONF_VARS["GFX"]["im_imvMaskState"] = '1'; // Modified or inserted by TYPO3 Install Tool.
has no effect on combine test
but gd test is screwed up then
-------------------

ImageMagick (5.3.9)
usage: composite [ options ... ] image composite [ mask ] composited
no combination of options seems to work
probably misscompiled
-------------------

ImageMagick (5.4.9)
usage: composite [ options ... ] image composite [ mask ] composited
exactly the same as 5.2.3
-------------------

ImageMagick (5.5.7)
usage: composite [ options ... ] image composite [ mask ] composited
exactly the same as 5.2.3 and 5.4.9
-------------------

ImageMagick (6.0.6)
usage: composite [ options ... ] change-file base-file [ mask-file ] output-image
exactly the same as 5.2.3, 5.4.9 and 5.5.7
-------------------

(issue imported from #M1188)


Files

Actions

Also available in: Atom PDF