Add features table, refactor test texture generation, encode alpha for A1R5G5B5 images #1
Loading…
Reference in New Issue
No description provided.
Delete Branch "features-table"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
New Features
tga_encoder
users can check for e.g.tga_encoder.features.scanline_order.top_bottom
.Bugfixes
A1R5G5B5
color format, the alpha channel is set to transparent if alpha < 128. The alpha channel was not encoded at all for theA1R5G5B5
color format previously, wasting an entire bit per pixel.Refactoring
Image Programs
Imagemagick
Decoding
Do not use a program that is part of imagemagick (e.g.
display(1)
) or relies on it to view/processtga_encoder
output.For years, imagemagick developers have assumed that scanline order and rotation information refer to the same concept. They refuse to fix any bugs that manifest as “images are shown/processed upside down”, telling users to use the
-auto-orient
command-line option (which seems to trigger the bug twice in most cases, therefore showing/processing images correctly).GIMP
Decoding
GIMP 2.10 shows colored garbage on transparent background for the following files:
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
This seems to be a bug in GIMP.
MTpaint
Transparency
mtpaint 3.40 does not show transparency for TGA type 1 images.
It is unclear if this is a bug in mtpaint or in
tga_encoder
.tga2ansi
tga2ansi shows all images as expected.
I wrote
tga2ansi
as a reference TGA decoder. Note thattga2ansi
has little error handling.Test Plan
Generate Images
generate_test_textures.lua
with thetools
subdirectory set as the working directory.Using a program of your choice (write down which one), verify that each of the following images can be loaded:
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
Visual Confirmation
Colors & Scanline Order
Using a program of your choice (write down which one), verify that each of the following images shows the letters T (red, closest to top left corner), G (green, center) and A (blue, closest to bottom right corner).
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
Using a program of your choice (write down which one), verify that each of the following images shows the letters T (gray, closest to top left corner), G (light gray, center) and A (dark gray, closest to bottom right corner).
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
Transparency
No Alpha Channel (B8G8R8, Y8)
Using a program of your choice (write down which one), verify that each of the following images has a black background and a white 2×2 square in the bottom left corner.
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
1-Bit Alpha Channel (A1R5G5B5)
Using a program of your choice (write down which one), verify that each of the following images has a transparent background and a white 2×2 square in the bottom left corner.
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
8-Bit Alpha Channel (B8G8R8A8)
Using a program of your choice (write down which one), verify that each of the following images has a partially transparent black background and a partially transparent white 2×2 square in the bottom left corner.
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
Results Table
You can use this table to report test results (change ☐ to ☑ on success and ☒ on failure). Ignore empty cells.
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
WIP: Add features table, refactor test texture generation, encode alpha for A1R5G5B5 imagesto Add features table, refactor test texture generation, encode alpha for A1R5G5B5 imagesI tested this in Minetest and found that it does not seem to render TGA Type 10 with scanline order “top_bottom” correctly (look at the corruption of the letter “A” in the second row).
I can not explain the thing where only the letter A is decoded.
First screenshot: TGA test nodes with Minetest 5.7.0-443-ga7e545609:
Second screenshot: TGA test nodes with Minetest 5.4.1
Status update:
The Minetest issue in 5.8.0-dev where only the blue letter A is shown might happen because BGRA input is evaluated as ARGB, as everything non-blue looks transparent. Changing IrrlichtMT
CColorConverter::convert_B8G8R8A8toA8R8G8B8
to just copy input to output fixes the issue, but this fix is obviously incorrect. Maybe the color conversion happens twice somehow?tga2ansi
rendering of generated test images for TGA type 1, 2, 3, 10:The alpha channel was not encoded for colormapped images using the
A1R5G5B5
color format.The bug has been fixed in in commit
50466ca08b
.I made a fix against Luanti (new name of Minetest) git tag
5.10.0-rc1
that makes transparent pixels in A1R5G5B5 textures no longer show up as black.You can apply this by piping it to
git am
.I made a fix against Luanti/Minetest git tag
5.10-rc1
that fixes the “only the blue A is rendered” bug.You can apply this by piping it to
git am
.Luant/Minetest merged my transparency fix as-it but contains a different fix for the other bug: https://github.com/minetest/minetest/pull/15402
Visual Confirmation using mtpaint
Colors & Scanline Order
Using a program of your choice (write down which one), verify that each of the following images shows the letters T (red, closest to top left corner), G (green, center) and A (blue, closest to bottom right corner).
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
Using a program of your choice (write down which one), verify that each of the following images shows the letters T (gray, closest to top left corner), G (light gray, center) and A (dark gray, closest to bottom right corner).
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
Transparency
No Alpha Channel (B8G8R8, Y8)
Using a program of your choice (write down which one), verify that each of the following images has a black background and a white 2×2 square in the bottom left corner.
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
1-Bit Alpha Channel (A1R5G5B5)
Using a program of your choice (write down which one), verify that each of the following images has a transparent background and a white 2×2 square in the bottom left corner.
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
(black background)type1-A1R5G5B5-top_bottom.tga
(black background)type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
8-Bit Alpha Channel (B8G8R8A8)
Using a program of your choice (write down which one), verify that each of the following images has a partially transparent black background and a partially transparent white 2×2 square in the bottom left corner.
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
(black background)type1-B8G8R8A8-top_bottom.tga
(black background)type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
I suspect I actually found a bug in MtPaint 3.40: The alpha channel is always rendered black in TGA type 1 files.
Visual Confirmation using tga2ansi
Colors & Scanline Order
Using a program of your choice (write down which one), verify that each of the following images shows the letters T (red, closest to top left corner), G (green, center) and A (blue, closest to bottom right corner).
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
Using a program of your choice (write down which one), verify that each of the following images shows the letters T (gray, closest to top left corner), G (light gray, center) and A (dark gray, closest to bottom right corner).
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
Transparency
No Alpha Channel (B8G8R8, Y8)
Using a program of your choice (write down which one), verify that each of the following images has a black background and a white 2×2 square in the bottom left corner.
type10-B8G8R8-bottom_top.tga
type10-B8G8R8-top_bottom.tga
type1-B8G8R8-bottom_top.tga
type1-B8G8R8-top_bottom.tga
type2-B8G8R8-bottom_top.tga
type2-B8G8R8-top_bottom.tga
type3-Y8-bottom_top.tga
type3-Y8-top_bottom.tga
1-Bit Alpha Channel (A1R5G5B5)
Using a program of your choice (write down which one), verify that each of the following images has a transparent background and a white 2×2 square in the bottom left corner.
type10-A1R5G5B5-bottom_top.tga
type10-A1R5G5B5-top_bottom.tga
type1-A1R5G5B5-bottom_top.tga
type1-A1R5G5B5-top_bottom.tga
type2-A1R5G5B5-bottom_top.tga
type2-A1R5G5B5-top_bottom.tga
8-Bit Alpha Channel (B8G8R8A8)
Using a program of your choice (write down which one), verify that each of the following images has a partially transparent black background and a partially transparent white 2×2 square in the bottom left corner.
type10-B8G8R8A8-bottom_top.tga
type10-B8G8R8A8-top_bottom.tga
type1-B8G8R8A8-bottom_top.tga
type1-B8G8R8A8-top_bottom.tga
type2-B8G8R8A8-bottom_top.tga
type2-B8G8R8A8-top_bottom.tga
Merged manually in
a9eceeba62
.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.