Bug 742 : load and save tga results in upside down tga
Last modified: 2008-03-13 19:35




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
polymonkey
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-03-05 13:20
loading a tga and then saving it out again results in the output of an
upside down tga.
version 0135
OS - OSX(10.5.2)
OS - WinXP

here is some code to replicate

line(10,10,90,90);

save("data/img.tga");

PImage img = loadImage("img.tga");
img.save("data/img2.tga");
exit();


and here is a workaround


line(10,10,90,90);
save("data/img.tga");

PImage img = loadImage("img.tga");

PImage outImg = createImage(img.width, img.height, ARGB);

for(int x = 0; x < outImg.width ; x++){

for(int y = 0; y < outImg.height ; y++){

outImg.pixels[x + (y * outImg.width)] = img.pixels[x + (((img.height-1)
- y) * img.width)];

}
}

img.save("data/img2.tga");
outImg.save("data/img2_fixed.tga");

exit();
Additional Comment #1 From fry 2008-03-13 18:35
found and fixed for 0136. thanks for the report.