-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use in ChromeWorker #3
Comments
Well, did you checkout this file: https://github.com/manuels/unix-toolbox.js-imagemagick/blob/master/demo/test.html |
Wow thanks so much for the fast reply! I did but I was super intimidated by the tons of files. I can't simply copy in interface.js, im not sure what all i have to copy and paste, is there some documentation on this stuff, im new to imagemagick :P |
So I dropped it in, and it loaded without errors, but when i try to run the exxample code it throws:
This is the line getting the error These are the files I dropped into my addon:Noitidart/Icon-Container-Generator@d84bbb7
I had to modify interface.js so it loaded into my ChromeWorker global instead of worker: So I unwrapped the anon: https://github.com/Noitidart/Icon-Container-Generator/blob/d84bbb719f1ae3fb2c81268705d1244b311d3e47/modules/unixToolbox/interface.js#L1 Then call it here: I can import convert-worker fine too, on the lines below that. But the sample code throws: the addUrl's dont thow |
A user just reached out to me and gave me a great idea. I made this addon to take a screenshot of all monitors using native api's for all os's: https://addons.mozilla.org/en-US/firefox/addon/nativeshot/ he wants to extend that to a screen recorder. so for that what i need to do is diff two screenshots, and whatever is the same i need to delete it from the second. does imagemagick js have something that can like diff and keep only the differences in second file? its not hard to do i can just do the byte array comparison but because yours is asm.js i think it would be way way way faster. thanks so much if you can help me get this working i can get this into the hands of a lot of people. with working examples in firefox addons and apps. i also do a bunch of documentation so would love to doc this stuff. |
You are passing the image url directly to |
Thanks checking right away! |
I updated it: Im getting these errors now: : NS_ERROR_UNKNOWN_PROTOCOL: convert-worker.js:30:0 |
change
to
|
Thanks man! I tried it but same thing :(
I even tried adding a slash in front of the image in the getFile:
to
didnt fix it :( |
Ahhh you know what, in ChromeWorker, xhr to local files returns a status of 0, which is failure code for non-http: http://stackoverflow.com/questions/25585359/how-to-xhr-local-files/25585841#25585841 I also think I might need to make the path a file uri before xhr'ing. |
Holy hell!! It works!! it output this text file:
Can you please point me in the direction of the docs, i want to see how i can write this with just OS.File.writeAtomic, as I was able to that in places like here: http://stackoverflow.com/questions/25585359/how-to-xhr-local-files/25585841#25585841 With simply: var promised = OS.File.writeAtomic(file, new Uint8Array(data)); |
I was trying to write my own function like getFile, but I was trying to do getFileArrBuf but it seems all postMessage as JSON.stringify'ed is this true? is there anyway that I can transfer the byte array? As documented here on mdn: https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage#Transfer_Example |
This is my attempt to add a Still working on it, if you can help i would sooo appreciate it, my biggest goal is to try to get it to transfer the byte array rather then JSON serializing it, as transfering byte array is super good for memory. |
Ok veryyy interesting, I think i got the arrbuf transfering, please see: Noitidart/Icon-Container-Generator@9855dd4 However when I write conver the file to .png or to .jpeg i dont see a difference in the written file: i currently do:
but if i change the occourances of this is where i console.logged:
|
Man so I'm shifting to production style: Noitidart/Icon-Container-Generator@f8fd62a I do the on load here: That triggers the Then in my function later on: allDone() is never triggering: It did a
And I was hoping that allDone() would fire Also is there somehwere to learn the syntax, like im not sure how to do identify width height, scale and overlap, im not sure what arguments to use etc. |
I seem to get the not sure if tahts the right thing to do. Also is there a an opposite to Also its ok that i dont give my pseudoName's an extension right? |
I also don't understand this pseudoName business
I thought the 2nd arg was the path to the pseudoDirectory, and then final is the pseudoName? this way doesnt seem to work. are there any docs on this? I also can't figure out how to use identify to get the file types and if image or not, and if image the height/width. Man sorry about this im real excited to use this but cant get it working with docs :( This is what i tried:
It tells me:
I also tried with full path:
|
So this is my thoughts, because my need is to load an array of images then:
so does this mean i have to put in Here is a screencast of what I am doing on the main thread right now: I want to move it into a worker: Youtube :: Icon Container Generator |
Hey @manuels forgive the bother, but if you are not available to chat this much is there a community/forum or something where I can chat to the users about this? I was looking for the best way to use these 3 workers as a single worker, without adding them all as then im up to 60mb, or maybe if theres a way to minify to remove the functions I dont use (overlap, scale, size)? |
maybe, gzipping the files is an option? |
I was thinking of using this in ChromeWorker for firefox addon. My needs were very basic, I am XHR'ing a file in, its either png, jpeg, or tiff, maybe gif but probably not.
But after loading I need to get the byte data/imagedata.
Then with imagedata's of multiple files i need to:
It seems this can handle all of that, but it has tons of other stuff which is awesome. But basically, i couldn't find how to pass in arraybuffer of png/jpeg/tiff and get back bytedata, is it possible with this?
Thanks
The text was updated successfully, but these errors were encountered: