Project

General

Profile

Actions

Bug #83407

closed

Cropping gif images results in errornous images

Added by Claus Harup over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2017-12-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Having a .gif image and trying to crop anywhere else than from (0,0) gives me an errornous image - both in the preview in BE and also when the image is processed in FE :-(


Files

2.png (120 KB) 2.png Claus Harup, 2017-12-21 13:18
1.png (386 KB) 1.png Claus Harup, 2017-12-21 13:18
jurica-koletic-321003.gif (3.12 MB) jurica-koletic-321003.gif Claus Harup, 2017-12-21 13:18
xmas.gif (953 KB) xmas.gif Claus Harup, 2017-12-21 21:47
xmas.jpg (270 KB) xmas.jpg Claus Harup, 2017-12-21 21:47
xmas.png (4.15 MB) xmas.png Claus Harup, 2017-12-21 21:47
Actions #1

Updated by Frans Saris over 6 years ago

What's the use-case for such a big gif image? Isn't it an option to go for a JPEG?

Is it a multi frame image?

Do you have the same issue with other gif files?

Updated by Claus Harup over 6 years ago

Hi Frans

....sure it an option to go with .png or .jpg, but tell that to ALL your clients :-)

Any gif I tried with..... - I have attached 3 images:

xmas.jpg (original)
xmas.png (xmas.jpg saved as .png)
xmas.gif (xmas.jpg saved as .gif)

..... so Im sure that the gif is not an animated gif :-)

I have cropped them all with 16:9 in the middle of the image and still the .gif fails :-(

Greatings Claus

Actions #3

Updated by Frans Saris about 6 years ago

confirmed, the result is a transparent image with the dimensions of the original with the cropped part.

Actions #4

Updated by Frans Saris about 6 years ago

Ok, looks like a GM issue:

command when processing gif files:

'/usr/bin/convert' +profile '*' -geometry 2000x1331! -crop 454x375+982+511 '/var/www/master/Web/content/user_upload/xmas.gif[0]' '/var/www/master/Web/typo3temp/assets/images/crop_b7068225b8.gif'

command when processing jpg files:

'/usr/bin/convert' +profile '*' -geometry 1900x1200! -crop 788x731+716+269 '/var/www/master/Web/content/user_upload/8583557560_ea525fcd38_o.jpg[0]' '/var/www/master/Web/typo3temp/assets/images/crop_3454656605.jpg'

Actions #5

Updated by Frans Saris about 6 years ago

Looks like we need to add some extra processing options for gif files https://stackoverflow.com/a/14036766/2757523

  • Animated gifs are often optimised to save space, but imagemagick doesn't seem to consider this when applying the crop command and treats each frame individually. -coalesce rebuilds the full frames.
  • Crop does not remove the canvas that it snipped from the image. Applying +repage after the crop will do this.
Actions #6

Updated by Gerrit Code Review about 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55269

Actions #7

Updated by Gerrit Code Review about 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55269

Actions #8

Updated by Gerrit Code Review about 6 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55980

Actions #9

Updated by Frans Saris about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF