Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't open tga images with palette #491

Closed
rofl0r opened this issue Nov 4, 2019 · 11 comments
Closed

can't open tga images with palette #491

rofl0r opened this issue Nov 4, 2019 · 11 comments
Labels

Comments

@rofl0r
Copy link

rofl0r commented Nov 4, 2019

here's an example file https://0x0.st/zgB4.tga

it seems handling of TGA_TYPE_MAPPED is entirely missing in imlib2

@rofl0r
Copy link
Author

rofl0r commented Nov 4, 2019

@Ferada
Copy link
Contributor

Ferada commented Nov 4, 2019

Since I've now done that myself (and there's a bit of setup involved), I can get it submitted to Imlib2 for you, @rofl0r, is that okay?


The case marked as /* currently not supported */ is what, anything other than the 3/4 component case?

@rofl0r
Copy link
Author

rofl0r commented Nov 4, 2019

i updated the patch with some security code so we don't end up in an unexpected code path when bpp != 8:
https://github.com/sabotage-linux/sabotage/blob/master/KEEP/imlib2-tga-palette.patch

Since I've now done that myself (and there's a bit of setup involved), I can get it submitted to Imlib2 for you, @rofl0r, is that okay?

that would be really nice! i struggled myself to get an account for phab.e

The case marked as /* currently not supported */ is what, anything other than the 3/4 component case?

right. tga seems to support[0] 16bit with 5551 encoding, but there is currently no support in imlib for it at all, and 8 bit with 8 bit palette doesn't really make sense anyway.

[0] http://www.paulbourke.net/dataformats/tga/

@rofl0r
Copy link
Author

rofl0r commented Nov 5, 2019

meanwhile i updated my patch to support palettized RLE-compressed pics too
(took me 5x longer than needed due to gnu-style indentation...)

@derf derf added the Imlib2 label Nov 7, 2019
@Ferada
Copy link
Contributor

Ferada commented Nov 7, 2019

@rofl0r apropos formatting, is https://github.com/sabotage-linux/sabotage/blob/c4f1fe5307dd21bd53d17c51f32049092d6c9d34/KEEP/imlib2-tga-palette.patch#L73 this correctly formatted? I genuinely do not know the rules about that particular style enough to say.


Submitted and waiting for review.

@rofl0r
Copy link
Author

rofl0r commented Nov 7, 2019

correctly formatted? I genuinely do not know the rules about that particular style enough to say.

me neither :) looks like we'll have to wait for complaints...

thanks!

@rofl0r
Copy link
Author

rofl0r commented Nov 8, 2019

patch against latest git is available here https://0x0.st/zEzS.patch

@rofl0r
Copy link
Author

rofl0r commented Nov 11, 2019

@Ferada would you please mention to kwo on the bugtracker that i fulfilled his request with the above patch ? or maybe you just send him here so i can interact with him directly.

@Ferada
Copy link
Contributor

Ferada commented Nov 13, 2019

Yes, updated. I ran indent as requested which made two minor changes, but I'll let them decide if that's worth it or not.

@Ferada
Copy link
Contributor

Ferada commented Nov 15, 2019

@rofl0r was merged, please go ahead and verify this works for you then.

Edit: Works for me FWIW.

@rofl0r
Copy link
Author

rofl0r commented Nov 15, 2019

thanks for your help! it works as expected, also with RLE compressed variant (e.g.: https://0x0.st/z6ZY.tga )

@rofl0r rofl0r closed this as completed Nov 15, 2019
0xd61 pushed a commit to 0xd61/imlib2 that referenced this issue Jan 20, 2022
Summary:
implemented 8 bit color mapped images with 24/32bpp palette.

This is coming from an issue on [[ derf/feh#491 | feh ]] to support indexed TGA images. Written by [[ https://github.com/rofl0r | rofl0r ]], I'm forwarding it because I already have the tools for submission set up.

N.b. I'm not terribly familiar with the particular code style, if there's anything to format differently I'm happy to update.

Test Plan:
- Compared [[ https://0x0.st/zgB4.tga | example file ]] with known good in GIMP, looks okay.
- Tested that said example file doesn't load without this patch (in feh, which uses Imlib2).

Reviewers: kwo

Differential Revision: https://phab.enlightenment.org/D10618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants