[TYPO3-dev] Conceptual bug in t3lib_stdgraphic.php - cropscale reduces color depth to 8bit

JoH asenau info at cybercraft.de
Thu Nov 2 23:27:57 CET 2006


>>>> Unless there is a good reason for not using this command, I will
>>>> try to create a patch to fix this behaviour as soon as possible
>>>> and put it into the bugtracker.
>>>>
>>>> Are there any ImageMagick specialists around, that could provide me
>>>> with the best IM command for this job?
>>>
>>> Fixed.
>>>
>>> DIFF has been attached to the following bug:
>>> http://bugs.typo3.org/view.php?id=4186
>>
>> I'm trying to understand why do you use 2 consecutive imagemagick
>> -crop commands.
>
> Maybe you can use -geometry (instead of GIFBUILER's offset)?

As far as I understood you can't crop from both sides in just one step.
Since the original "cropscale" feature is using a second parameter after the
"c" to move the cropped area form the center based on percentage, you have
to crop the top and left side first, followed by the bottom and right side.

width = 200c
height = 200c

will crop scale down the image until one of the dimensions reaches 200px.
Then the rest will be cropped to fit the area calculated from the center of
the image.
So landscape pictures will lose the same amount of pixels from the left and
the right side, while portrait pictures will lose the same amount from the
top and the bottom.

To change this behaviour you can add a range from -100 to +100 to the
parameter

width = 200c-100
height = 200c-100

will crop from the top left corner

width = 200c+100
height = 200c+100

will crop form the bottom right corner

I tried to do it with a double crop command but this doesn't seem to work
with the API functions.

At least the result is now as expected but based on pure IM commands _and_
the output is 24bit instead of 8.

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com






More information about the TYPO3-dev mailing list