pngjs | Simple PNG encoder/decoder | Image Editing library

 by   lukeapage JavaScript Version: 6.0.0 License: Non-SPDX

kandi X-RAY | pngjs Summary

kandi X-RAY | pngjs Summary

pngjs is a JavaScript library typically used in Media, Image Editing applications. pngjs has no bugs, it has no vulnerabilities and it has low support. However pngjs has a Non-SPDX License. You can install using 'npm i pngjs' or download it from GitHub, npm.

Simple PNG encoder/decoder for Node.js with no dependencies. Based on the original pngjs with the follow enhancements.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pngjs has a low active ecosystem.
              It has 572 star(s) with 91 fork(s). There are 8 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 36 open issues and 75 have been closed. On average issues are closed in 370 days. There are 13 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of pngjs is 6.0.0

            kandi-Quality Quality

              pngjs has 0 bugs and 0 code smells.

            kandi-Security Security

              pngjs has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pngjs code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pngjs has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              pngjs releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.
              pngjs saves you 413 person hours of effort in developing the same functionality from scratch.
              It has 981 lines of code, 0 functions and 35 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pngjs and discovered the below as its top functions. This is intended to give you an instant insight into pngjs implemented functionality, and help decide if they suit your requirements.
            • Retrieve bit depth in data .
            • Get the RGBA data
            • Splits an array into two chunks .
            • Handle incoming chunks .
            • replace the alpha color
            • Inflate the output .
            • Compile colors .
            • Scale the size .
            • Pushes a buffer in a buffer .
            • Maps image data to an image .
            Get all kandi verified functions for this library.

            pngjs Key Features

            No Key Features are available at this moment for pngjs.

            pngjs Examples and Code Snippets

            No Code Snippets are available at this moment for pngjs.

            Community Discussions

            QUESTION

            Nodejs - Writing and encoding a PNG file with only FS and ZLIB modules
            Asked 2021-Dec-27 at 08:16

            I'm trying to generate a .png image from a hexadecimal color string (#RRGGBB), without using modules like pngjs or jimp.

            The hex string looks like this:

            ...

            ANSWER

            Answered 2021-Dec-27 at 08:16

            Those pixels in a PNG (you will need to dramatically embiggen in order to see the six pixels):

            Hex dump:

            Source https://stackoverflow.com/questions/70487775

            QUESTION

            How do you convert a 32bit RGB png with encoded height values to 16 bit png using browser side javascript?
            Asked 2021-Sep-30 at 18:59

            I am trying to create a 16bit heightmap png from a 32bit Rgb encoded height value png.

            According to mapbox I can decode their png pixel values to height values in meters with this formula. height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)

            I am new to understanding this type of information and have tried to figure it out myself but I need some help.

            I found this program called image-js, docs for this program are here . Note I am using this in the browser not with node.

            I think it has the abilities that I need. However, I am really not sure how to get the data from the original image and create a new 16bit png with the new height values calculated from the above formula.

            If you look in the docs under image I can set many properties such as

            bitDepth and set that to 16

            getPixelsArray() this function will give me an array of pixels values in the form of r,g,b. I think I can then run each pixel through the above formula to get the height. After that how do I turn this height data back into a 16bit grayscale heightmap png?

            Thanks!

            Example images. 32bit Rgb encoded height value png

            16 bit heightmap png. You have to zoom in to see the image changes

            Update:

            Thanks to traktor for the suggestion. I wanted to add some information to my question.

            I don't necessarily need to use image-js. My main goal is to get a 16 bit heightmap from a 32 bit RGB. So any other browser side javscript method would be fine. I also am using browser side createWritable(); stream to write file to disk.

            I have a method used from this nice module https://github.com/colkassad/terrain-rgb-height however I cannot get the browser side version of pngjs to work correctly. I think there is a difference between browser side stream reader/writers and node reader/writers that make it not work.

            Thanks!

            ...

            ANSWER

            Answered 2021-Sep-30 at 18:59

            Looking through the source code for Image-js package on GitHub turns up that the options object used in calls to the library is verified in source file kind.js which enumerates supported options properties in the assignment statement:

            Source https://stackoverflow.com/questions/69384779

            QUESTION

            How can i get specific fileld from the Mongo DB
            Asked 2021-Aug-15 at 12:59

            I have written below code which is fetching 3 documents , from that document i want to display only specific filed excluding the other field

            ...

            ANSWER

            Answered 2021-Aug-15 at 12:59

            For official node.js MongoDB driver. The syntax for projection is like this

            Source https://stackoverflow.com/questions/68790943

            QUESTION

            NodeJS peaking at 6Gb when manipulating images with Jimp
            Asked 2021-Aug-07 at 15:21

            I need to edit 34 000 photos on a pixel scale, so I wrote a program that replaces pixels in an image if they are over a specific RBG value (240, 240, 240), basically I want to isolate only white pixels and set everything else to black. This is my code:

            ...

            ANSWER

            Answered 2021-Aug-07 at 15:21

            Alright, so asynchronous done correctly was the answer in the end, credit to NeonSurvivor#2046 for this answer given to me on Discord!

            Source https://stackoverflow.com/questions/68691843

            QUESTION

            How to make node.js program wait for a PNG to parse?
            Asked 2020-Aug-16 at 18:31

            I am writing a project which requires me to load a lot of low resolution PNGs (~10k) to train my neural network. This is my code

            NOTE: This project uses 'pngjs' module

            ...

            ANSWER

            Answered 2020-Aug-16 at 13:40

            I suppose you would like to await its loading phase before proceeding. Luckily there is a keyword for that; namely await. It must be paired with async. Check it out.

            Edit: The idea in general is that you would make an array of so-called Promises (related to async and await); one Promise for each image. You can then await the completion of all these asynchronous Promises, i.e. when all images are loaded. And after that you can do what you want while still having all images load asynchronously in beforehand. (Hint: Promise.all)

            Source https://stackoverflow.com/questions/63437439

            QUESTION

            how to draw a line using pureimage?
            Asked 2020-Aug-01 at 13:32

            I'm new to node.js and this is just a small thing I need as part of a project that I'm writing in a different language.

            How would I go about using pureimage to make a line from a start position to an end position and exporting it as a png? I'm interested in using pureimage because to my understanding you can set the line width with a variable

            I currently have a working program with pngjs-draw but it's impossible to change line width there.

            ...

            ANSWER

            Answered 2020-Aug-01 at 13:32

            You can specify the line thickness with the lineWidth property. Then you can draw your line in the canvas 2D context and export your image as a png file with pureimage, like this:

            Source https://stackoverflow.com/questions/63204689

            QUESTION

            Method from the pngjs library acts weirdly in Node.js
            Asked 2020-Jul-13 at 11:16

            I am ordering images by a score value calculated by the getImageScore method, which is wrapped in a promise, as it takes quite some time to load the pixels it has to work with. I observed that the promises get blocked, never being finished. This was the initial whole program:

            ...

            ANSWER

            Answered 2020-Jul-13 at 11:16

            Fortunately, someone from Facebook (Iulian Popescu) told me that files.forEach doesn't wait for the promises to finish, therefore they get blocked. I managed to solve this situation, by adding more promises. For sample, one of the promises reads all the data. After reading all the data and saving it in some global variables, the other promises would get executed, in the right order. If you'd like to actually see the implementation of the solution I'm talking about, you can check it out on my GitHub: https://github.com/tomaAlex/darkImageClassifier/blob/master/index.js

            Source https://stackoverflow.com/questions/62838362

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pngjs

            You can install using 'npm i pngjs' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i pngjs

          • CLONE
          • HTTPS

            https://github.com/lukeapage/pngjs.git

          • CLI

            gh repo clone lukeapage/pngjs

          • sshUrl

            git@github.com:lukeapage/pngjs.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link