Skip to content

Commit 6848eb6

Browse files
committed
Merge branch 'GifToImg' of github.com:RTnhN/FileConverter into RTnhN-GifToImg
# Conflicts: # Application/FileConverter/App.config # Application/FileConverter/ConversionJobs/ConversionJob_ImageMagick.cs # Application/FileConverter/FileConverter.csproj # Application/FileConverter/packages.config # CHANGELOG.md # README.md
2 parents 6a5bdfc + cff6b14 commit 6848eb6

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

Application/FileConverter/ConversionJobs/ConversionJobFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public static ConversionJob Create(ConversionPreset conversionPreset, string inp
4343
return new ConversionJob_ImageMagick(conversionPreset, inputFilePath);
4444
}
4545

46-
if (Helpers.GetExtensionCategory(inputFileExtension) == Helpers.InputCategoryNames.Image ||
47-
Helpers.GetExtensionCategory(inputFileExtension) == Helpers.InputCategoryNames.Document)
46+
if (conversionPreset.OutputType == OutputType.Jpg ||
47+
conversionPreset.OutputType == OutputType.Png ||
48+
conversionPreset.OutputType == OutputType.Webp)
4849
{
4950
return new ConversionJob_ImageMagick(conversionPreset, inputFilePath);
5051
}

Application/FileConverter/ConversionJobs/ConversionJob_ImageMagick.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ protected override void Convert()
8686
readSettings.Format = MagickFormat.Dng;
8787
break;
8888

89+
case ".gif":
90+
// Get the first frame of the gif for conversion.
91+
// Maybe in the future make this user selectable.
92+
readSettings.FrameIndex = 0;
93+
break;
94+
8995
default:
9096
break;
9197
}

Application/FileConverter/Helpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static bool IsOutputTypeCompatibleWithCategory(OutputType outputType, str
216216
case OutputType.Jpg:
217217
case OutputType.Png:
218218
case OutputType.Webp:
219-
return category == InputCategoryNames.Image || category == InputCategoryNames.Document;
219+
return category == InputCategoryNames.Image || category == InputCategoryNames.Document || category == InputCategoryNames.AnimatedImage;
220220

221221
case OutputType.Gif:
222222
return category == InputCategoryNames.Image || category == InputCategoryNames.Video || category == InputCategoryNames.AnimatedImage;

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Next Version
44

55
- New: Option to use NVidia hardware acceleration for mp4 video (thanks to tacheometry).
6+
- New: Add Gif to Image conversion support (issue #433, #115) (thanks to RTnhN)
67
- New: Persian translation (thanks to MrHero118 and Mehrdad32).
78
- New: Serbian translation (thanks to crnobog69).
89
- New: Japanese translation (thanks to oogamiyuta).

0 commit comments

Comments
 (0)