Comments (6)
Pillow 6.2.2 was released more than four years ago. Would you be able to find a newer version of Pillow that works as expected?
I looked through the history of the TGA image plugin since 6.2.2 and didn't notice anything, so it may a change to some other file that caused this.
from pillow.
The demo code that the user provided doesn't use the TGA format, so I think this is just about DDS. I think Pillow 8.2.0 would be the last version that gives the result you want, and that the change came from #5383.
If I manually eyedrop the top left corner in Gimp, I get (192, 192, 192).
If I convert your image to a PNG using ImageMagick and get the top left pixel using Pillow, I get (192, 192, 192, 0)
I suspect PVRTextool only works on Windows. Is that the case?
Could you attach a copy of what you think the image should look like, in a common format like PNG?
This is what Pillow thinks the image should look like, ImageMagick agrees, and so does https://imagetostl.com/view-dds-online.
I'm not convinced that Pillow is behaving incorrectly.
from pillow.
Thanks for the reply. Yes It is more likely related to the DDS plugin. And here is the png I got from PVRTextool's File - Save Image
function and this what I expect.
This is also what I see from PVRTextool. I'm not sure if PVRTexTool only works on Windows, but I usually use it to view texture data.
What I see from PVRTextool, including channel's information and raw texel data.
from pillow.
Thanks for the image.
My conclusion from my previous comment is that Pillow is not incorrect, and nothing needs to be changed here.
Here's some more evidence to consider
- someone saying that PVRTexTool doesn't read A8R8G8B8 correctly - https://www.gamedev.net/forums/topic/692707-directx-texture-tool/5359502#post_5359503
- in the issue that prompted this new behaviour, here's a user saying that Windows Texture Viewer disagreed with the old behaviour that you are after - #4264 (comment)
If you would like Pillow to create your version of the image from A8R8G8B8 images, you could move the channels around only for those images like so
from PIL import Image
with Image.open("water6_1x4.dds") as img:
if img.tile[-1][-1] == (32, (16711680, 65280, 255, 4278190080)):
r, g, b, a = img.split()
img = Image.merge("RGBA", (g, b, a, r))
img.save("out.png")
from pillow.
Thank you for your patient explanation. After a careful troubleshooting process lasting for almost two days, we have basically confirmed that the issue is caused by a bug or bizarre behavior in PVRTextool related to uncompressed DDS textures.
We discovered that, interestingly, the rendering error in our game was not caused by Pillow's DDS reading. Instead, it was precisely due to a brief usage of a newer version of the PVRTextool(v5.5.0) during the update of our cacheserver project, for compressing from DDS to ASTC, which led to the issue. This will turn the texture into yellow(different channel data), just like the png file I uploaded above. But the previous version of PVRTextool(v4.20) will not encounter this issue. Pillow won't either. And we confirmed that if the uncompressed DDS textures are preprocessed by using Pillow they will render correctly in the game.
Viewing the uncompressed DDS textures using tools like Nvidia Texture Tool shows different results compared to PVRTextool.
So it seems that there might be an issue with how PVRTextool handles uncompressed DDS textures, causing problems when viewing or compressing using command-line tools.
from pillow.
Thanks for figuring that out. It may be helpful to anyone else encountering this in the future.
from pillow.
Related Issues (20)
- Empty JPEG2000 image after upgrading from 10.2.0 to 10.3.0 HOT 5
- fontfamily (font1 (include some chars)+font2(include most chars)) cannot show some characters HOT 1
- Error: cannot import name '_imagingft' HOT 11
- JPEG image has wrong size HOT 2
- ImageSequence encounters an exception when JPEG pixels exceed 4096*4096 HOT 2
- `ImageMath.eval` deprecation warning running `selftest.py` HOT 1
- Memory leak when opening images HOT 3
- Add small number of carefully curated screenshots to handbook tutorial HOT 4
- KeyError: 'setting text direction, language or font features is not supported without libraqm' HOT 3
- Wrong JPEG library version: library is 90, caller expects 80 HOT 2
- BGR;15/16 scaling HOT 7
- Can't install Pillow on Ubuntu HOT 13
- Unable to open AVIF images HOT 1
- Unknown test comment HOT 6
- cannot identify image file (PNG file from scanner) HOT 20
- toqpixmap() doesn't work with PyQt5 HOT 6
- Grayscale PNG converted with standard tool to 8-bit grayscale TIFF won't load HOT 4
- GIFs saving with unexpected transparency (or perhaps undefined pixels?) HOT 6
- Image CMS modes HOT 5
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 pillow.