mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Use "-dispose background" to improve reassembly of GIFs with transparency
Summary: Fixes T5741. We break GIFs apart with "-coalesce" which completely rasterizes each frame, but stitch them back together without specifying "-dispose". This produces the default "-dispose none" behavior, which causes GIF frames to "pile up" if they contain transparency. Instead, use "-dispose background" so that the previous frame is erased before each new frame is drawn. Test Plan: See T5741 for additional details. Maniphest Tasks: T5741 Differential Revision: https://secure.phabricator.com/D19214
This commit is contained in:
parent
598d0c04e7
commit
a4a390fe2d
1 changed files with 9 additions and 3 deletions
|
@ -236,7 +236,10 @@ final class PhabricatorMemeEngine extends Phobject {
|
|||
Filesystem::writeFile($output_name, $memed_frame_data);
|
||||
}
|
||||
|
||||
$future = new ExecFuture('convert -loop 0 %Ls %s', $output_files, $output);
|
||||
$future = new ExecFuture(
|
||||
'convert -dispose background -loop 0 %Ls %s',
|
||||
$output_files,
|
||||
$output);
|
||||
$future->setTimeout(10)->resolvex();
|
||||
|
||||
return Filesystem::readFile($output);
|
||||
|
@ -297,6 +300,9 @@ final class PhabricatorMemeEngine extends Phobject {
|
|||
$font_max = 72;
|
||||
$font_min = 5;
|
||||
|
||||
$margin_x = 16;
|
||||
$margin_y = 16;
|
||||
|
||||
$last = null;
|
||||
$cursor = floor(($font_max + $font_min) / 2);
|
||||
$min = $font_min;
|
||||
|
@ -321,12 +327,12 @@ final class PhabricatorMemeEngine extends Phobject {
|
|||
// text extends, for example if it has a "y".
|
||||
$descend = $box[3];
|
||||
|
||||
if ($height > $dim_y) {
|
||||
if (($height + $margin_y) > $dim_y) {
|
||||
$all_fit = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($width > $dim_x) {
|
||||
if (($width + $margin_x) > $dim_x) {
|
||||
$all_fit = false;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue