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

Add RLE decode support for TGA image format #73

Closed
wants to merge 1 commit into from

Conversation

blogdron
Copy link
Contributor

@blogdron blogdron commented Oct 21, 2021

Many image editors with exports apply RLE compression for TGA format. I initially could not understand why I had noise instead of images, it turned out that the images were compressed :D. There is slow (but simple) realization of unpacking.

Plus for images with channels less than 3 I added duplication of the channels. This allows forcibly loading them, albeit with costs.

The test program for unpacking works well.

#include "corange.h"
/*    TGA RLE Decode Test    */
int main(int argc, char *argv[])
{
    //load rle image and decode
    image * i = image_tga_load_file("./rle-image.tga");
    //write no rle image
    image_tga_save_file(i,"./output.tga");
};

I hope it will be useful

IMPORTANT: If you used, for example, GIMP and created a compressed RLE TGA image in it, and then you unpacked it through the Corange back to the file files will not be the same bit in the bit. This is not an error just at the end there will not be 26 bytes of the image basement. This does not affect anything simply when saving the basement is not added. Therefore, the file size is always equal to 18 bytes header + Size X + Size Y * Number of channels.

@blogdron
Copy link
Contributor Author

I wrote the code badly, so I should probably close the pull request.
I'll try to fix it and make everything good, but maybe someone will do it for me, because I'm a lazy hedgehog =)

@blogdron blogdron closed this Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant