Comments (4)
Hello,
What was the exact image? I could use it as a test case to ensure there is no bug.
The intended behaviour is that if there are less than 257 colors, LodePNG writes the alpha channels in the tRNS chunk (see point 4.2.1.1. here: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html).
So there are multiple ways that a PNG image file can be semi-translucent: either it uses the RGBA or Grey+Alpha color format, or, it uses a palette, with a tRNS chunk containing the alpha value for each palette index. Of course the latter method has smaller filesize, so is chosen for less than 257 colors.
Normally, most software reads that tRNS chunk, but in theory is allowed to ignore it. What program do you view the PNG image with?
Thanks!
from lodepng.
Hey, you're right! It was Paint Shop Pro 7 (very very old, but it does what I need and I'm used to it). Other software deals with the output just fine.
Thanks and sorry!
from lodepng.
No problem, interesting to know. I'll consider adding a setting (no promises tho :)) for this, after all the PNG spec specifically mentions software is allowed to ignore it...
from lodepng.
Just FYI, I ran into this same problem while using the C function lodepng_encode32_file
. Viewing the PNG in Gimp and it looks like there's only two states for the alpha channel. In Gimp for the output PNG, some pixels look to be completely translucent when they go below a certain threshold while others aren't, but it's either all or none.
Using Imagemagick to convert to a BMP and then viewing through Gimp renders just fine so the alpha channel is definitely there and isn't being lost.
I don't know what the answer is but you might want to consider defaulting to 8-bit RGBA instead of trying to be clever and using a colormap.
from lodepng.
Related Issues (20)
- fatal error LNK1120: 4 unresolved externals HOT 1
- W64 HOT 2
- sdl2 HOT 6
- vulnerability Discover HOT 2
- what's mean of this define LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS and when should i define it
- code optimization
- Че за хрень 64 бит компиляция HOT 1
- Sudden increase in build size HOT 1
- Memory leaks in function benchmark.
- SEGV on unknown address in function pngdetail. HOT 2
- How to get a JSON string from the encoded image ? HOT 3
- Expected speed? HOT 6
- Fix warnings: `conversion from 'size_t' to 'unsigned short', possible loss of data` HOT 2
- chunk type is restricted to the decimal values 65 to 90 and 97 to 122
- Veracode discovered a race condition
- Consideration for changing the License to public domain
- allocate "reserved_size" extra memory
- Lodepng fails to open valid png image HOT 4
- Clarification on "filter_palette_zero"
- lodepng crashes ntdll.dll
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lodepng.