question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animated GIF become JPEG

See original GitHub issue

Hi,

When I want to use an animated GIF with the picker, the image I receive is a JPEG. Do you know how to tell the picker this image is a GIF and aplly to it a GIF data64?

I’m on Android, my piece of code:

selectPhotoTapped() {
        const options = {
            quality: 1.0,
            maxWidth: 800,
            maxHeight: 800,
            title: 'Select a picture',
            cancelButtonTitle: 'Cancel',
            title: 'Select a picture',
            cancelButtonTitle: 'Cancel',
            takePhotoButtonTitle: 'Take picture',
            chooseFromLibraryButtonTitle: 'Phone'
            //noData: false, // we use response.data to display gif
            //allowsEditing: false // make sure we don't edit the gif
        };
        ImagePicker.showImagePicker(options, (response) => {
            if (response.didCancel) { }
            else if (response.error) { alert('ImagePicker Error: ', response.error); }
            else if (response.customButton) { alert('User tapped custom button: ', response.customButton); }
            else {
                var source;
                source = {uri: 'data:image/jpeg;base64,' + response.data, isStatic: true};
                //Or:
                //if (Platform.OS === 'android') { source = {uri: response.uri, isStatic: true}; }
                //else { source = {uri: response.uri.replace('file://', ''), isStatic: true}; }
                //this.setState({ avatarSource: source });
                this.setState({ photo: source });
                this.setState({ photoUpload: source.uri });
            }
        });
}

Thank you for your help!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SiyabongaNzulwanacommented, Sep 9, 2020

@yfuks in my case I am resizing the image deliberately, I just want a way that when the gallery of my photo opens, we filter out gif … so my gallery would only show image/jpeg or image/png ONLY. so that the user does not get a chance to select gif

0reactions
RatFoucommented, Oct 14, 2016

My bad, I sent full header to Imagick, not just the data64. Thanks for your time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

GIF to JPG (Online & Free) - Convertio
Best way to convert your GIF to JPG file in seconds. 100% free, secure and easy to use! Convertio — advanced online tool...
Read more >
GIF to JPG converter (online) - Ezgif
Upload a GIF and this tool will output high quality JPG image(s). It can also convert animated GIFs, in this case a sequence...
Read more >
How to Save a GIF File As a JPEG - Techwalla
Navigate to the directory and file folder in which you wish to save your image. Type the name of the new JPEG file...
Read more >
GIF to JPG - online-convert.com
Convert GIF to JPG in high quality by using this online file converter. ... Try the JPG conversion with a GIF test file....
Read more >
GIF to JPEG Converter - Online Image Tools
These options will be used automatically if you select this example. Frame For animated GIFs, you can extract a specific frame here. Play...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found