Create GRF from BMP or HTML5 Canvas pixel data - javascript

How can I create a Zebra GRF image from HTML5 canvas pixel data or a monochrome BMP file using javascript? I can't find any information on the format of GRF files.

Here is the ZPL programming manual.
The ~DG command will tell you the format of the GRF format. Then it's just some math

You might have to convert this Java code to Javascript, but I came across this and make a command line java app to help. If you can go to the server at all, then you could probably just invoke this app through shell.
https://github.com/asharif/img2grf

Related

How can I convert a wav blob to other audio types using javascript?

I need to use either a FLAC or PCM audio type. Is there a library or an algorithm to convert to either of these?
You can not do that using pure javascript. You will need at least an encoder with command line interface, and a server side script (like PHP) to access that and do the conversion.
(edit) I just found this link, I stand corrected if it really works: https://github.com/sopel39/audioconverter.js/tree/master

nodejs creating wafeform from mp3 in svg

i'm making a research for the topic of getting a mp3 file rendered as waveform. i've already found some php libraries. now i'm looking for a similar solution in nodejs.
my results so far are:
https://github.com/afreiday/php-waveform-svg
http://www.schillmania.com/projects/soundmanager2/ (maybe loading this in nodejs to try rendering the wave file in svg-format... not quiet sure)
have you guys experience with nodejs-libraries to create waveforms in svg format?
Not a directly nodejs-related solution.
We use a Linux commandline tool Sonic Annotator to extract waveform (peaks) and detect beat in audio files. Its a host that can run VAMP plugins that are quite good at these tasks.
Peaks are extracted as a set of floats from 0 to 1 at equal intervals. SHould be rather simple to build an svg on top of that data (with D3 i.e.).
I'm not used to nodejs, but the docs says it can run external commands.

Need to convert PCX graphic to binary

I have an application that requires I convert a PCX graphic to binary. There is very little info on the internet on how to do this. I can accomplish this with canvas.toDataURL using JS but only for PNG and JPEG graphic files. This is not for a SQL database as I think you can do it there. Any help would be appreciated, even if it involves using an app to get me there.
I have no idea what you mean by your question, but I presume that if you can do whatever it is that you want with a JPEG file but can't do that with a PCX file, it would help if you could convert your PCX to a JPEG.
So I would suggest you use "convert" from ImageMagick (here)
convert image.pcx image.jpg
Here is a text file:
This is the first line
You can read me, con't you?
Yes, it's because I am text
Here is a binary file:
<FF><D8><FF><E0>^#^PJFIF^#^A^A^A^#^A^#^A^#^#<FF><DB>^#C^#^C^B^B^B^B^B^C^B^B^B^C^C^C^C^D
^L^R^S^R^P^S^O^P^P^P<FF><DB>^#C^A^C^C^C^D^C^D^H^D^D^H^P^K ^K^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P^P<FF><C0>^#^Q^H^A<90>^#<C8>^C^A"^#^B^Q^A^C^Q^A<FF><C4>^#^]^#^#^#^G^A^A^A^#^#^#^#^#^#^#^#^#^#^#^B^C
^D^E^F^G^H^A <FF><C4>^#8^P^#^A^C^C^C^B^E^B^D^F^C^#^B^C^#^#^A^B^C^Q^#^D!^E^R1^FA^G^S"Qaq<81>^T2<91><A1>^H^U#B<B1><D1>R<C1><E1>^V<F0>3br<FF><C4>^#^Z^A^#^B^C^A^A^#^#^#^#^#^#^#^#^#^#^#^B^C^A^D^E^#^F<FF><C4>^#/^Q^#^B^B^A^D^A^C^

draw SVG with javascript online and in terminal

I need to display some data online but I also would like to have nice plots as high-res files for printing. So far I was generating the plots as png, but now I am thinking on changing this to Javascript. This is mainly because I would like my plots to be dynamic.
The WWW part is looks relatively easy for me; I would grab data from a server with AJAX and plot on a webpage - I think SVG would be perfect for my needs. But how can I run the script from terminal with a file name as a parameter to get a myplot.svg (which of course will not be dynamic any longer) file that looks like the plot on the webpage?
Ideally I would like to have a single plotting subroutine in order to avoid duplicate code and to keep both versions looking the same.
So my questions are which framework should I use for SVG generation to make the terminal variant easy ?
You can use ImageMagick to convert a SVG to png:
ImageMagick convert svg to png
You can extract the generated SVG from a virtual DOM (with the same code as on your web page, perhaps with slightly differences regarding environment) when you use Node.js and jsdom
As mentioned in the comment I can recommend D3.js - Data Driven Documents for generating SVG the easy way.
An alternative for Node.js and jsdom might be Phantom.js.
Your task is not an easy one, but it's worth the effort. Good luck!

read a file line by line using javaScript

i want to Build Android Apps with HTML, CSS, and JavaScript. I need to read file. A local file that contain questions (A data base of question). i think it is possible with javaScript , is it true? please help and share your information.
Thanks in advance
Yes, using HTML5 FileReader API. The best source for that is , http://www.html5rocks.com/en/tutorials/file/dndfiles/.
Scroll down to reading files.
FileReader.readAsText(Blob|File, opt_encoding)
Split the content with EOL character for UTF-8.
Note: By default the string is decoded as 'UTF-8'.

Categories

Resources