Converting Videos to GIFs in Kotlin-Based Android Apps With Cloudinary
Among the image formats available today, Graphics Interchange Format(GIF)works for both static and animated images. A popular use of GIF images—commonly called GIFs—is to repeatedly loop motions, which you cannot in real life. Many people have turned themselves into online celebrities through effective application of GIFs.
Cloudinary is a robust, cloud-based, end-to-end platform for uploads, storage, manipulations, optimizations, and delivery of images and videos. Notably for manipulations, you can add appeal to visual media by transforming themthrough resizing and application of various effects.
This article steps you through the procedure of leveraging Cloudinary to convert a video in an Android demo app, written in Kotlin, to a GIF. It’s a helpful task well worth learning.
Now set up an Android client by following the steps in the subsections below.
Creating an Android Project
Open Android Studio and create an Android project.
In the Create Android Project screen, select the Empty Activity template. Click Next.
In the Configure your projectscreen that is displayed, type the application name, package name, and so forth in the text fields. Select Kotlin as the language.Select API 16: Android 4.1(Jelly Bean) from the pull-down menu as your minimum SDK, i.e., the lowest Android version supported by your app. Click Finish.
Configuring Cloudinary
Configure Cloudinary, as follows:
Edit your project’sbuild.gradle file to add the Cloudinary dependency so as to gain access to Cloudinary’s features:
Fulfilling the Preliminary Requirements
Setting Up an Android Client
Creating an Android Project
Configuring Cloudinary
implementation group: 'com.cloudinary', name: 'cloudinary-android', version: '1.24.0'
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.cloudinarysample">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
...
>
<meta-data
android:name="CLOUDINARY_URL"
android:value="cloudinary://@myCloudName"/>
</application>
</manifest>