Image file to txt for dot matrix print [closed]









up vote
-1
down vote

favorite












help, who understands dot matrix print ...
I have a signature file, now the user wants the print result to have a signature. I am confused how to put the signature image file to * .txt om. there is a solution?










share|improve this question







New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as unclear what you're asking by Quentin, Graham, pirho, Alexei, EdChum Nov 10 at 16:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Your question is very unclear. What does JavaScript have to do with this? What does PHP have to do with this? What is "a signature file"? Is it a text file containing a standard sign off message as you might configure your email client to use? Is it a bitmap image of the type of signature someone would sign with a pen at the bottom of a letter? What is this .txt file that you want to add it to? Where does this "dot matrix print" come into it? Is this about printing to an old low-res hard copy printer? From JS or PHP or something else? You should probably show some code to provide context.
    – Quentin
    Nov 10 at 14:35














up vote
-1
down vote

favorite












help, who understands dot matrix print ...
I have a signature file, now the user wants the print result to have a signature. I am confused how to put the signature image file to * .txt om. there is a solution?










share|improve this question







New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as unclear what you're asking by Quentin, Graham, pirho, Alexei, EdChum Nov 10 at 16:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Your question is very unclear. What does JavaScript have to do with this? What does PHP have to do with this? What is "a signature file"? Is it a text file containing a standard sign off message as you might configure your email client to use? Is it a bitmap image of the type of signature someone would sign with a pen at the bottom of a letter? What is this .txt file that you want to add it to? Where does this "dot matrix print" come into it? Is this about printing to an old low-res hard copy printer? From JS or PHP or something else? You should probably show some code to provide context.
    – Quentin
    Nov 10 at 14:35












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











help, who understands dot matrix print ...
I have a signature file, now the user wants the print result to have a signature. I am confused how to put the signature image file to * .txt om. there is a solution?










share|improve this question







New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











help, who understands dot matrix print ...
I have a signature file, now the user wants the print result to have a signature. I am confused how to put the signature image file to * .txt om. there is a solution?







javascript php dot-matrix






share|improve this question







New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 10 at 14:11









Irvan Indriyan

1




1




New contributor




Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Irvan Indriyan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




closed as unclear what you're asking by Quentin, Graham, pirho, Alexei, EdChum Nov 10 at 16:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Quentin, Graham, pirho, Alexei, EdChum Nov 10 at 16:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • Your question is very unclear. What does JavaScript have to do with this? What does PHP have to do with this? What is "a signature file"? Is it a text file containing a standard sign off message as you might configure your email client to use? Is it a bitmap image of the type of signature someone would sign with a pen at the bottom of a letter? What is this .txt file that you want to add it to? Where does this "dot matrix print" come into it? Is this about printing to an old low-res hard copy printer? From JS or PHP or something else? You should probably show some code to provide context.
    – Quentin
    Nov 10 at 14:35
















  • Your question is very unclear. What does JavaScript have to do with this? What does PHP have to do with this? What is "a signature file"? Is it a text file containing a standard sign off message as you might configure your email client to use? Is it a bitmap image of the type of signature someone would sign with a pen at the bottom of a letter? What is this .txt file that you want to add it to? Where does this "dot matrix print" come into it? Is this about printing to an old low-res hard copy printer? From JS or PHP or something else? You should probably show some code to provide context.
    – Quentin
    Nov 10 at 14:35















Your question is very unclear. What does JavaScript have to do with this? What does PHP have to do with this? What is "a signature file"? Is it a text file containing a standard sign off message as you might configure your email client to use? Is it a bitmap image of the type of signature someone would sign with a pen at the bottom of a letter? What is this .txt file that you want to add it to? Where does this "dot matrix print" come into it? Is this about printing to an old low-res hard copy printer? From JS or PHP or something else? You should probably show some code to provide context.
– Quentin
Nov 10 at 14:35




Your question is very unclear. What does JavaScript have to do with this? What does PHP have to do with this? What is "a signature file"? Is it a text file containing a standard sign off message as you might configure your email client to use? Is it a bitmap image of the type of signature someone would sign with a pen at the bottom of a letter? What is this .txt file that you want to add it to? Where does this "dot matrix print" come into it? Is this about printing to an old low-res hard copy printer? From JS or PHP or something else? You should probably show some code to provide context.
– Quentin
Nov 10 at 14:35












1 Answer
1






active

oldest

votes

















up vote
-1
down vote













The technique is to write a canvas element using the image:



In order to do it, you need:



  1. create the canvas with width and height that are equal to image's width and height

  2. draw the image into it

const image = document.getElementById('yourImage');
const canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = myImage.height;
const ctx = canvas.getContext('2d');
ctx.drawImage(image, 0, 0);



Now you can get the array as you wanted.
any element in array is RGBA.



const imageData = ctx.getImageData(0, 0, image.width, image.height);



Note: The image needs to be on same domain!



Otherwise, you can't do it (no matter if it's public on the internet).






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    -1
    down vote













    The technique is to write a canvas element using the image:



    In order to do it, you need:



    1. create the canvas with width and height that are equal to image's width and height

    2. draw the image into it

    const image = document.getElementById('yourImage');
    const canvas = document.createElement('canvas');
    canvas.width = image.width;
    canvas.height = myImage.height;
    const ctx = canvas.getContext('2d');
    ctx.drawImage(image, 0, 0);



    Now you can get the array as you wanted.
    any element in array is RGBA.



    const imageData = ctx.getImageData(0, 0, image.width, image.height);



    Note: The image needs to be on same domain!



    Otherwise, you can't do it (no matter if it's public on the internet).






    share|improve this answer
























      up vote
      -1
      down vote













      The technique is to write a canvas element using the image:



      In order to do it, you need:



      1. create the canvas with width and height that are equal to image's width and height

      2. draw the image into it

      const image = document.getElementById('yourImage');
      const canvas = document.createElement('canvas');
      canvas.width = image.width;
      canvas.height = myImage.height;
      const ctx = canvas.getContext('2d');
      ctx.drawImage(image, 0, 0);



      Now you can get the array as you wanted.
      any element in array is RGBA.



      const imageData = ctx.getImageData(0, 0, image.width, image.height);



      Note: The image needs to be on same domain!



      Otherwise, you can't do it (no matter if it's public on the internet).






      share|improve this answer






















        up vote
        -1
        down vote










        up vote
        -1
        down vote









        The technique is to write a canvas element using the image:



        In order to do it, you need:



        1. create the canvas with width and height that are equal to image's width and height

        2. draw the image into it

        const image = document.getElementById('yourImage');
        const canvas = document.createElement('canvas');
        canvas.width = image.width;
        canvas.height = myImage.height;
        const ctx = canvas.getContext('2d');
        ctx.drawImage(image, 0, 0);



        Now you can get the array as you wanted.
        any element in array is RGBA.



        const imageData = ctx.getImageData(0, 0, image.width, image.height);



        Note: The image needs to be on same domain!



        Otherwise, you can't do it (no matter if it's public on the internet).






        share|improve this answer












        The technique is to write a canvas element using the image:



        In order to do it, you need:



        1. create the canvas with width and height that are equal to image's width and height

        2. draw the image into it

        const image = document.getElementById('yourImage');
        const canvas = document.createElement('canvas');
        canvas.width = image.width;
        canvas.height = myImage.height;
        const ctx = canvas.getContext('2d');
        ctx.drawImage(image, 0, 0);



        Now you can get the array as you wanted.
        any element in array is RGBA.



        const imageData = ctx.getImageData(0, 0, image.width, image.height);



        Note: The image needs to be on same domain!



        Otherwise, you can't do it (no matter if it's public on the internet).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 at 14:28









        Alon Shmiel

        1,0621565113




        1,0621565113













            這個網誌中的熱門文章

            Barbados

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3