Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Initial VTF support

Open REDxEYE opened this issue 3 years ago • 17 comments

This pull request adds initial support for VTF image format

Changes proposed in this pull request:

  • Add support for Valve Texture Format images

REDxEYE avatar Aug 07 '22 01:08 REDxEYE

Can I provide arguments to save the function? Like compression mode, flags and etc?

REDxEYE avatar Aug 07 '22 13:08 REDxEYE

Like im.save("out.vtf", compression=...)? Yes. Those arguments will become part of the im.encoderinfo dictionary.

radarhere avatar Aug 08 '22 00:08 radarhere

Yes, that's just what I needed, thanks!

REDxEYE avatar Aug 08 '22 06:08 REDxEYE

@radarhere Do I need to encode the image row-by-row or i can go like 4 rows at once because Bcn works in blocks of 4 by 4 pixels? I never worked with Pillow C API, so i need some help

REDxEYE avatar Aug 09 '22 19:08 REDxEYE

@radarhere Do I need to encode the image row-by-row or i can go like 4 rows at once because Bcn works in blocks of 4 by 4 pixels? I never worked with Pillow C API, so i need some help

No, you don't have to.

A while ago, I attempted to implement DXT1 encoding. You might find that helpful - https://github.com/radarhere/Pillow/commit/363fab4f9ba151fa2ce283832cfea70fa9eabef8

radarhere avatar Aug 10 '22 09:08 radarhere

I see, your attempt is quite close to what I wrote, but I used a different way to get 2 main colors for the block. Can I reuse some of your code from 363fab4?

REDxEYE avatar Aug 10 '22 09:08 REDxEYE

Feel free

radarhere avatar Aug 10 '22 09:08 radarhere

@radarhere Can you please review my bcn encoder?

REDxEYE avatar Aug 12 '22 00:08 REDxEYE

Slightly confused - this PR is still a draft, but you'd like a review?

Also, your lint problems could be resolved by just using the black formatting - https://github.com/REDxEYE/Pillow/pull/2. Is there a particular part of the styling that you dislike?

radarhere avatar Aug 12 '22 13:08 radarhere

Slightly confused - this PR is still a draft, but you'd like a review?

Also, your lint problems could be resolved by just using the black formatting - REDxEYE#2. Is there a particular part of the styling that you dislike?

I'm asking for a encoder code review, pr itself not even close to be ready :)

REDxEYE avatar Aug 12 '22 13:08 REDxEYE