Code Monkey home page Code Monkey logo

Comments (3)

drake7707 avatar drake7707 commented on July 17, 2024

Can you check the console if there is any more to the error? I tested it with the examples in chrome (Version 71.0.3578.98 (Official Build) (64-bit)) and it works as expected.

The svg download works by creating a ´´ link with the svg data encoded as url (data:image/svg+xml format). If you inspect the ´´ tag you should find the links after you clicked the Download SVG button.

image

If you click on that url, does it work then or do you still get an error?

from paintbynumbersgenerator.

xenoguy avatar xenoguy commented on July 17, 2024

did a bit more testing, and it does work sometimes, but i haven't been able to figure out why it breaks when it breaks.

I turned off all my chrome plugins to make sure it wasn't any of those.

no errors in the JS console.

if i switch to the trivial example and download that svg, it works fine, and then try the medium example image, that then works as well. but it failed initially.

i did manage to copy the elements from a working vs a broken link. and i assume it should be the same svg data for the same image, with the default parameters. but they're different for some reason. I'll attach them here. It's probably a syntax error in the encoding that happens sometimes?

also, thanks for making and releasing this software, it's great! much more advanced than other pbn generators.
svg-broken.txt
svg-working.txt

from paintbynumbersgenerator.

drake7707 avatar drake7707 commented on July 17, 2024

They'll be different each time because of the random factor involved. K-means clustering has random initial centroids that converge to local maximum points. The corresponding color of those local maximum points as palette, so while it will likely converge to the colors that are most present, they might end up in a different local maxima on the next run. Pretty much the entire segmentation relies on grouping colors so from there on out the result will likely be similar but not entirely the same.

It might be something to do with the length, not sure if there is a maximum length of the attribute. The links you copied are chopped off at some length (around the 2mb mark it seems), but that might be the clipboard limit.

I'll try and reproduce it by running it a few times.

EDIT: while I was typing that I was running it a few times on small and was able to reproduce it so it doesn't look like a length issue.

decodeURIComponent($($("body > a[download='paintbynumbers.svg']").last().get(0)).attr("href").split(",")[1])

seems to yield valid SVG though. I saved the output from the console to a .svg file and it opened fine.

EDIT2: Seems the labels are the culprit. When I uncheck the labels and only generate the border and fill, it works.

Seems https://stackoverflow.com/a/46403589/694640 using a Blob does work on the same generated SVG. I'll use that method to fix the issue. I've tested in firefox and it still works there too. I don't have Edge on this machine so I can't test there.

from paintbynumbersgenerator.

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.