Skip to content

Commit

Permalink
Handle GIF with ImageMagick
Browse files Browse the repository at this point in the history
Using FFmpeg could lead to crash. This removes support converting videos to animated GIF. See: robertsanseries#110
  • Loading branch information
City-busz committed Jul 8, 2020
1 parent 871a895 commit 6444a33
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions src/Controllers/ConverterController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ namespace Ciano.Controllers {
break;
} else {
// there is no return on image conversion, if display is pq was generated some error.
if (item.type_item != TypeItemEnum.IMAGE || this.name_format_selected.down () == "gif") {
if (item.type_item != TypeItemEnum.IMAGE) {
process_line (str_return, row, ref total, error);

if (error > 0) {
Expand Down Expand Up @@ -552,26 +552,8 @@ namespace Ciano.Controllers {
array.add ("-2");
array.add (new_file);
} else if (this.type_item == TypeItemEnum.IMAGE) {
if (this.name_format_selected.down () == "gif") {
array.add ("ffmpeg");
array.add ("-y");
array.add ("-i");
array.add (uri);

if("webm" == FileUtil.get_file_extension_name(uri)) {
array.add ("-pix_fmt");
array.add ("rgb8");
} else {
array.add ("-ss");
array.add ("00:00:00.000");
array.add ("-vf");
array.add ("format=rgb8,format=rgb24");
}
} else {
array.add ("convert");
array.add (uri);
}

array.add ("convert");
array.add (uri);
array.add (new_file);
}

Expand Down Expand Up @@ -738,10 +720,7 @@ namespace Ciano.Controllers {
formats = get_array_formats_image (Constants.TEXT_ICO);
break;
case Constants.TEXT_GIF:
formats = ArrayUtil.join_generic_string_arrays (
get_array_formats_image (Constants.TEXT_GIF),
get_array_formats_videos (StringUtil.EMPTY)
);
formats = get_array_formats_image (Constants.TEXT_GIF);
break;
case Constants.TEXT_TGA:
formats = get_array_formats_image (Constants.TEXT_TGA);
Expand Down Expand Up @@ -821,7 +800,7 @@ namespace Ciano.Controllers {
array.add (Constants.TEXT_OGV.up());
}

if(format_video != Constants.TEXT_WEBM && format_video != Constants.TEXT_GIF && this.type_item == TypeItemEnum.VIDEO) {
if(format_video != Constants.TEXT_WEBM) {
array.add (Constants.TEXT_WEBM);
array.add (Constants.TEXT_WEBM.up());
}
Expand Down Expand Up @@ -951,4 +930,4 @@ namespace Ciano.Controllers {
return array;
}
}
}
}

0 comments on commit 6444a33

Please sign in to comment.