pngtastic | A pure Java PNG image optimization and manipulation library | Compression library
kandi X-RAY | pngtastic Summary
kandi X-RAY | pngtastic Summary
Pngtastic is PNG for Java. Just one small jar with no dependencies. It doesn't rely on AWT, so it can be used in restrictive environments like Google App Engine (and probably Android, but haven't tried). The latest code adds the ability to optimize png images using the new zopfli deflate compression algorithm. The java port is based heavily on this. If you're willing to sacrifice compression speed in exchange for ridiculously good compression ratios, you'll want to try using the optional zopfli compressor. So far I'm seeing better compression ratios for my test images than even the excellent ImageOptim app produces.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Main method for testing
- Compress a single file
- Read a buffer of bytes into a byte array
- Create a new png image
- Process the head chunk
- Perform the base and layering
- Encodes the given raw byte buffer into the given output buffer
- Encodes the given ByteBuffer to the given character buffer
- De - filter input
- Returns the probability of the pth line
- Decode the given data to a file
- Encode data to a file
- Closes this output stream
- Decodes a binary file into a file
- Encodes a file into a base64 string
- Compares two pixels
- Deleting image
- Cache the distance symbols
- Prepare and return an array of DistCacheExtra bits
- Insert the given chunk into the image
- Flushes the compressed stream
- Applies filters to the image
- Main entry point for testing purposes
- Main entry point
- Counts the number of pixels in the image
- Entry point for the program
pngtastic Key Features
pngtastic Examples and Code Snippets
Community Discussions
Trending Discussions on pngtastic
QUESTION
Images from our website do not display in Safari for some Mac users and they report seeing either no image or a black image. Here is an example:
http://s3-eu-west-2.amazonaws.com/bp18.boxcleverpress.com/Boxclever_logo_chartreuse.png
What I have discovered is:
- Images display on PC
- Images display on SOME Macs (I have an older one that is OK)
- Images display on iPhones and iPads
- Images are PNG
- I have optimised the images with pngtastic
- When images are copied to the Mac and opened with Adobe Photoshop they give the error: the file format module cannot parse the file
- When I tried to open a pngtastic optimised file in Photoshop Elements on Windows I also get that error
- When I tried to open the optimised file in Photoshop on Windows I get the error IDAT: incorrect data check
I will replace the optimised images with unoptimised ones but I am not sure if this problem is with pngtastic or Adobe image libraries or something else.
...ANSWER
Answered 2018-Jan-09 at 11:31The problem appears to be due to the use of the zopfli compression in the PNGs that I optimised using pngtastic. The workaround is to use a different pngtastic compression option and the PNGs are then readable in Photoshop.
Using a different compression algorithm will result in less optimisation.
I am not sure why the zopfli compression is a problem, it could be that there is a fault in my code (although the same code works fine when only the zopli option is changed), in pngtastic, or that MacOS and Adobe don't support zopfli.
@usr2564301 has done some investigation and it appears the Adler-32 checksum on the compressed data in my example image is incorrect. usr2564301 has also tested the pngtastic code and found it to produce the correct checksum. The problem might be in how I handle the bytestream out of pngtastic.
The code below performs the PNG optimisation using pngtastic (com.googlecode.pngtastic.core)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pngtastic
You can use pngtastic like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the pngtastic component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page