Comments (5)
Hi,
I tried out decoding it with the "showpng" example (examples/example_sdl.cpp), and it looks correct to me.
The image has an alpha channel though, a translucent background. Which part has the wrong color when you view it, the gear, or the background?
Thanks!
from lodepng.
https://blog.littlevgl.com/2018-10-05/png_converter
see the image, red is converted to blue, blue is converted to read
from lodepng.
Which color should the gear have? For me it's blue with gray
from lodepng.
I read from https://lodev.org/lodepng/, found the words like below:
So I change my code fork from 'https://blog.littlevgl.com/2018-10-05/png_converter'. change R to B, B to R, Then I display color right to my pc now.
//c = LV_COLOR_MAKE(img_argb[i].red, img_argb[i].green, img_argb[i].blue);
c = LV_COLOR_MAKE(img_argb[i].blue, img_argb[i].green, img_argb[i].red);
Q: The image is wrong when using LodePNG with BITMAPs in Visual Studio or win32, or with BMP images.
A: LodePNG uses raw buffers with RGBA or RGB pixels in the common order RGBARGBARGBA... or RGBRGBRGBRGB..., from top to bottom, without any special byte boundaries. BMP images and bitmaps in win32 use a different format. They do three things differently:
Instead of being from top to bottom, it goes from bottom to top (upside down).
Instead of using the order red, green, blue, it uses the order blue, green, red, or BGRBGRBGR..., (can result in wrong colors).
It has a limitation where rows always must be a multiple of 4 bytes, so if the width of the image is not a multiple of 4 some unused bytes are introduced at the end of each row (can result in a skewed image).
All of this are related to how BMP works, not how PNG or LodePNG work. When you're working with BMP, you need to take each of these three things into account and convert this to/from the buffer format that LodePNG uses. Also check out the png2bmp and bmp2png samples, which already do this.
from lodepng.
Indeed! Thanks for pointing to BITMAP.
Indeed those examples show how to convert between BMP and PNG, direct links to them:
https://github.com/lvandeve/lodepng/blob/master/examples/example_png2bmp.cpp
https://github.com/lvandeve/lodepng/blob/master/examples/example_bmp2png.cpp
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.