GIFGenerator 0.3.0

GIFGenerator 0.3.0

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2017 年 8 月
SwiftSwift 版本3.0
SPM支持 SPM

Eduardo Urso 维护。



.GIFGenerator

添加到项目

有 2 种方法可以将 .GIFGenerator 添加到您的项目中

手动安装

只需将‘GIFGenerator’文件夹导入到您的项目中,然后导入您要使用的类。

Obj-C

#import "GIFGenerator.h"

Swift

import GIFGenerator

Podfile

platform :ios, '8.0'
pod "GIFGenerator"

实际使用

let gifGenerator = GifGenerator()

gifGenerator.generateGifFromImages(imagesArray, frameDelay: 0.5, destinationURL: url, callback: { (data, error) -> () in
  //returns a gif file.
})

//ATENTION: you must provide the part of the video that you want to convert, so if you need to convert just from the 0:10 to 0:20 sec. you must cut and deal with the video before you send it to the library.
gifGenerator.generateGifFromVideoURL(videoURL: url, framesInterval: 10, frameDelay: 0.2, destinationURL: NSURL(fileURLWithPath: destinationPath), callback: { (data, error) -> () in
  //returns a gif file.
})

这将从提供的图像或视频文件生成 GIF

这个库轻量,且非常直接。一旦你有图像数组,将它传给 GIFGenerator,同时传入 URL 和帧延迟。让我为你解释这些

imagesArray - array of images that will compose the GIF file!
frameDelay  -  is the amount of time between each frame in the GIF.
destinationURL  - is the url where the GIF file will be stored.

或者如果你有视频 URL,将它传给 GIFGenerator,同时传入 URL 和帧延迟。让我为你解释这些

videoURL - url where the video is stored that will compose the GIF file!
frameDelay  -  is the amount of time between each frame in the GIF.
destinationURL  - is the url where the GIF file will be stored.

我建议你调整这些参数,看看它们如何影响 GIF 文件。

示例项目

要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install

作者

Eduardo Urso, [email protected]

如果您有任何疑问、评论或改进意见,请随时给我发邮件。

许可

GIFGenerator 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。