Coder Social home page Coder Social logo

Saving annotations? about imageview.jl HOT 7 OPEN

juliaimages avatar juliaimages commented on July 28, 2024
Saving annotations?

from imageview.jl.

Comments (7)

timholy avatar timholy commented on July 28, 2024

I guess we should add a Save as... to the context menu?

from imageview.jl.

timholy avatar timholy commented on July 28, 2024

Just to check, do you know you can do this?

Cairo.write_to_png(imgc.c.back, "/tmp/annot.png")

That will write the Canvas exactly as it is (including the padding, if any, to set the aspect ratio) to a file.

from imageview.jl.

timholy avatar timholy commented on July 28, 2024

I added some functions to trim the padding: JuliaGraphics/Cairo.jl@98007fc and 35ce5b4. Pkg.update() will get you both updates.

Still probably want to add it to the context menu, so I'll leave this open.

from imageview.jl.

rsrock avatar rsrock commented on July 28, 2024

Hi Tim,
Was out at a GRC. Did not know this-- thanks for the info and adding the write function.

from imageview.jl.

rsrock avatar rsrock commented on July 28, 2024

3+ years later, and I'm back 😄. This appears to work now:

function write_to_png(guidict, filename)
    canvas = guidict["gui"]["canvas"]
    ctx = getgc(canvas)
    Cairo.write_to_png(ctx.surface, filename)
end

[edit] Spoke too soon. The getgc sometimes fails with UndefRefError: access to undefined reference. I don't quite understand that one, because I'm calling this after a guidict = imshow(img), and I see the image so the context should be there. I'm starting to get the feeling that I don't know what I'm doing here...

from imageview.jl.

rsrock avatar rsrock commented on July 28, 2024

Ok, after poking at this for a bit, I'm stumped. The call to getgc() (or drilling into the context field directly) always fails from a test script with UndefRefError: access to undefined reference, and always succeeds from the REPL.

The problem isn't because the window gets destroyed at the end of the script, because the error occurs before then. Adding the bit of code at the end of the README.md to wait on the window close event did not help either.

I've tried adding gc_preserve() calls, but I'm not sure I hit the right incantation. I'm also not sure why they'd be necessary given this line in GtkReactive: https://github.com/JuliaGizmos/GtkReactive.jl/blob/8179c208ff5fa16d6d4879c8dce578cc68eff59b/src/graphics_interaction.jl#L244

Why is my graphic context vaporizing here? Pinging @timholy for desperately needed help!

from imageview.jl.

szcf-weiya avatar szcf-weiya commented on July 28, 2024

Hi @rsrock , I am wondering if it is possible to save gif/mp4 for movie-like images, i.e., images with the time axis.

from imageview.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.