Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Avoid to resize GtkImage #515

Closed
Kelvyn88 opened this issue Jul 17, 2020 · 1 comment
Closed

Avoid to resize GtkImage #515

Kelvyn88 opened this issue Jul 17, 2020 · 1 comment

Comments

@Kelvyn88
Copy link

Hi,

I want to attach an image file to a GtkImage. But the GtkImage object always resize to fit the image file.

Any suggestion to avoid that behaviour? I need to fix a specific size for the window that contains the GtkImage.

Thanks

@Kelvyn88
Copy link
Author

for those interested in this issue:

using Luxor, Gtk.ShortNames

    w, h = screen_size()

    Drawing(round(w/3.5), round(h/2.5), "path_to_save_file.png")

    origin()
    background("white")


    img = readpng(path_to_original_file)
    w = img.width
    h = img.height

    scale(0.4, 0.4)
    placeimage(img, -w/2, -h/2, 1)

    finish()

    # save the scaled image
    preview()

    indexImg = Image()
    set_gtk_property!(indexImg, :file, "path_to_save_file.png")

    w = Window(indexImg)
    Gtk.showall(w)

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

No branches or pull requests

1 participant