Forum Archive

Can ui.imageview() display gif images?

donnieh

Can ui.imageview() display gif images?

JonB

ImageView can only display ui.Images... but ui.Image.named() should be able to open a gif, at least of the non animated variety.

ccc

https://forum.omz-software.com/topic/2319/multi-frame-gifs-to-clipboard-or-photos might be helpful.

Webmaster4o

I think he means animated gifs @JonB

mieq

It works when using ImageView.load_from_url.

import ui


def load(sender):
    url = 'https://img01.sogoucdn.com/app/a/100540022/2019030913484662642362.gif'
    img_v.load_from_url(url)

frame = 0, 0, *ui.get_screen_size()

v = ui.View()
v.background_color = 'white'
v.right_button_items = [
    ui.ButtonItem(
        title='Load',
        action=load,
    )
]
img_v = ui.ImageView(frame=frame)
img_v.content_mode = ui.CONTENT_CENTER
v.add_subview(img_v)
v.present('fullscreen')

But I really want to know how can I use ui.ImageView to display local gif files.

cvp

@mieq see here

mieq

@cvp said:

@mieq see here

oh, you are so genius.👍Thanks a lot!

mieq

@cvp Learn a lot from your script,Thanks again for your help.😆