Skip to content

Fix save tga when IL_ORIGIN_UPPER_LEFT is set#112

Open
Mizzrym1 wants to merge 1 commit intoDentonW:masterfrom
Mizzrym1:fix_save_tga
Open

Fix save tga when IL_ORIGIN_UPPER_LEFT is set#112
Mizzrym1 wants to merge 1 commit intoDentonW:masterfrom
Mizzrym1:fix_save_tga

Conversation

@Mizzrym1
Copy link

@Mizzrym1 Mizzrym1 commented Jan 7, 2026

Remove flip two times:
if (TempImage->Origin == IL_ORIGIN_UPPER_LEFT)
Temp |= 0x20; //set 5th bit

Fix this:
ilInit();

ILuint imageID;
ilGenImages(1, &imageID);
ilBindImage(imageID);
ilEnable(IL_ORIGIN_SET);
ilOriginFunc(IL_ORIGIN_UPPER_LEFT);

if(!ilLoad(IL_TYPE_UNKNOWN, "in.tga"))
	std::cerr << "ilLoad Error" << std::endl;

ilEnable(IL_FILE_OVERWRITE);
if(!ilSave(IL_TGA, (const ILstring) "out.tga"))
	std::cerr << "ilSave Error" << std::endl;

ilDeleteImages(1, &imageID);
ilShutDown();

in.tga:
obraz

out.tga:
obraz

Remove flip two times:
if (TempImage->Origin == IL_ORIGIN_UPPER_LEFT)
	Temp |= 0x20; //set 5th bit
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