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

Background-image blurry and degraded after exporting to svg #166

Open
hovo1990 opened this issue Feb 16, 2022 · 0 comments
Open

Background-image blurry and degraded after exporting to svg #166

hovo1990 opened this issue Feb 16, 2022 · 0 comments

Comments

@hovo1990
Copy link

hovo1990 commented Feb 16, 2022

I have put inside nodes svg files as background-images,

Inside the web browser (Chrome) the quality is good, but after exporting the background image quality degrades significantly.

image

image

Using the following callback to generate Image from cytoscape:

@app.callback(
    Output("cytoscape", "generateImage"),
    [
        Input("as-svg-button", "n_clicks"),
        Input("as-png-button", "n_clicks"),
    ])
def get_image(get_svg_clicks,get_png_clicks):

    # detect which button was pressed
    changed_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
    if changed_id == 'as-svg-button.n_clicks':
        ftype= "svg"
    elif changed_id == 'as-png-button.n_clicks':
        ftype= "png"

    # File type to output of 'svg, 'png', 'jpg', or 'jpeg' (alias of 'jpg')
    #ftype = tab #tab

    # 'store': Stores the image data in 'imageData' !only jpg/png are supported
    # 'download'`: Downloads the image as a file with all data handling
    # 'both'`: Stores image data and downloads image as file.
    #action = 'store'
    action = 'download'


    return {
        'type': ftype,
        'action': action,
        'filename': 'Output_Graph'
    }

Dash version:
Dash 2.0.0
Dash Core Components 2.0.0
Dash HTML Components 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant