Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreliable detection of SVG images #2053

Closed
zyxapple98 opened this issue Nov 9, 2023 · 3 comments
Closed

Unreliable detection of SVG images #2053

zyxapple98 opened this issue Nov 9, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@zyxapple98
Copy link

Description
I have a certain image (shape is 704*832).
After converting it into base64 string, I use ft.Image(src_base64) to render that image on UI, but it turns out to be blank.
The weirdest thing is, if I modify some pixels on that image, everthing will go well.
The script producing this bug is simple and short enough, but the bug can be reproduced on multiple machines.

Code example to reproduce the issue:

import flet as ft
import cv2 as cv
import base64
img = cv.imread('rotate.png')
#cv.line(img, (0, 0), (511, 511), (255, 0, 0), 5) # modify a few pixels and it can be displayed
_, buffer = cv.imencode('.png', img)
string =  base64.b64encode(buffer).decode('utf-8')

def main(page: ft.Page):
    page.add(
        ft.Image(
            src_base64=string,
        )
    )

ft.app(target=main)

Describe the results you received:

blank image on UI.

Additional information you deem important (e.g. issue happens only occasionally):
I have reproduced this bug on three different machines. If I modify or resize the source, everything is ok.
This magical image is available in attachment.

Flet version (pip show flet):

Name: flet
Version: 0.10.3
Summary: Flet for Python - easily build interactive multi-platform apps in Python

Operating system:
Windows 10
rotate

Additional environment details:

@zyxapple98
Copy link
Author

I add page.on_error to see the error, here is the result:

Page error: XmlParserException: name expected at 30:27
Page error: XmlParserException: name expected at 30:27
Page error: XmlParserException: name expected at 30:27
Page error: XmlParserException: name expected at 30:27
Page error: XmlParserException: name expected at 30:27
Page error: XmlParserException: name expected at 30:27

@FeodorFitsner
Copy link
Contributor

Could you please provide a more complete repro with image contents? Output that string and paste it here?

@zyxapple98
Copy link
Author

Sure, here's the string, please check in rotate.txt:
rotate.txt

Could you please provide a more complete repro with image contents? Output that string and paste it here?

@FeodorFitsner FeodorFitsner added the bug Something isn't working label Nov 10, 2023
@FeodorFitsner FeodorFitsner changed the title Bug: A magical image can never be displayed. Unreliable detection of SGV images Nov 10, 2023
@FeodorFitsner FeodorFitsner changed the title Unreliable detection of SGV images Unreliable detection of SVG images Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants