-
Notifications
You must be signed in to change notification settings - Fork 254
Closed
Description
I'm trying to generate sample data for the --mini implementation, and have that option turned on.
I have a small PNG file that I've edited using GIMP to add transparency. That also got me XMP and EXIF.

The input PNG does appear to contain alpha:
$ pnginfo complex_osm_tile_alpha.png
complex_osm_tile_alpha.png...
Image Width: 256 Image Length: 256
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 4
Pixel depth (Pixel Depth): 32
Colour Type (Photometric Interpretation): RGB with alpha channel
Image filter: Single row per byte filter
Interlacing: No interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: 2835, 2835 (pixels per meter)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 2
Raw profile type exif (iTXt uncompressed): \nexif\n 214\n45786966000049492a00080000000a000001040001000000000100000101040001000000\n000100000201030003000000860000001201030001000000010000001a01050001000000\n8c0000001b0105000100000094000000280103000100000002000000310102000d000000\n9c0000003201020014000000aa0000006987040001000000be0000000000000008000800\n08004800000001000000480000000100000047494d5020322e31302e3336000032303234\n3a31303a30352031343a33363a353200010001a00300010000000100000000000000\n
XML:com.adobe.xmp (iTXt uncompressed): <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>\n<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">\n <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n <rdf:Description rdf:about=""\n xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"\n xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:GIMP="http://www.gimp.org/xmp/"\n xmlns:tiff="http://ns.adobe.com/tiff/1.0/"\n xmlns:xmp="http://ns.adobe.com/xap/1.0/"\n xmpMM:DocumentID="gimp:docid:gimp:e3853fab-b07c-40da-b1ed-c5c5e3fbc6c1"\n xmpMM:InstanceID="xmp.iid:e037e460-3180-4c9a-aa61-da7bbb2a7a50"\n xmpMM:OriginalDocumentID="xmp.did:9e3cab2b-1874-4011-87b1-abdb9eddc649"\n dc:Format="image/png"\n GIMP:API="2.0"\n GIMP:Platform="Linux"\n GIMP:TimeStamp="1728103033942514"\n GIMP:Version="2.10.36"\n tiff:Orientation="1"\n xmp:CreatorTool="GIMP 2.10"\n xmp:MetadataDate="2024:10:05T14:36:52+10:00"\n xmp:ModifyDate="2024:10:05T14:36:52+10:00">\n <xmpMM:History>\n <rdf:Seq>\n <rdf:li\n stEvt:action="saved"\n stEvt:changed="/"\n stEvt:instanceID="xmp.iid:e8515914-4dfa-41a7-ba92-0c58f6288e4c"\n stEvt:softwareAgent="Gimp 2.10 (Linux)"\n stEvt:when="2024-10-05T14:37:13+10:00"/>\n </rdf:Seq>\n </xmpMM:History>\n </rdf:Description>\n </rdf:RDF>\n</x:xmpmeta>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n<?xpacket end="w"?>
When I encode that, it appears there is no alpha channel being included:
$ ~/coding/libavif/build/avifenc complex_osm_tile_alpha.png complex_osm_tile_alpha.avif
Successfully loaded: complex_osm_tile_alpha.png
AVIF to be written: (Lossy)
* Resolution : 256x256
* Bit Depth : 8
* Format : YUV444
* Alpha : Not premultiplied
* Range : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile : Present (672 bytes)
* XMP Metadata : Present (3426 bytes)
* Exif Metadata : Present (208 bytes)
* Transformations: None
* Progressive : Unavailable
Encoding with codec 'aom' speed [6], color quality [60 (Medium)], alpha quality [100 (Lossless)], tileRowsLog2 [0], tileColsLog2 [0], 16 worker thread(s), please wait...
Encoded successfully.
* Color total size: 6459 bytes
* Alpha total size: 0 bytes
Wrote AVIF: complex_osm_tile_alpha.avif
When dumping out the structure (using libheif), I do not see an alpha item:
Box: ftyp -----
size: 32 (header size: 8)
major brand: avif
minor version: 0
compatible brands: avif,mif1,miaf,MA1A
Box: meta -----
size: 1057 (header size: 12)
| Box: hdlr -----
| size: 33 (header size: 12)
| pre_defined: 0
| handler_type: pict
| name:
|
| Box: pitm -----
| size: 14 (header size: 12)
| item_ID: 1
|
| Box: iloc -----
| size: 58 (header size: 12)
| item ID: 1
| construction method: 0
| data_reference_index: 0
| base_offset: 0
| extents: 4735,6459
| item ID: 2
| construction method: 0
| data_reference_index: 0
| base_offset: 0
| extents: 1097,212
| item ID: 3
| construction method: 0
| data_reference_index: 0
| base_offset: 0
| extents: 1309,3426
|
| Box: iinf -----
| size: 109 (header size: 12)
| | Box: infe -----
| | size: 26 (header size: 12)
| | item_ID: 1
| | item_protection_index: 0
| | item_type: av01
| | item_name: Color
| | hidden item: false
| |
| | Box: infe -----
| | size: 25 (header size: 12)
| | item_ID: 2
| | item_protection_index: 0
| | item_type: Exif
| | item_name: Exif
| | hidden item: false
| |
| | Box: infe -----
| | size: 44 (header size: 12)
| | item_ID: 3
| | item_protection_index: 0
| | item_type: mime
| | item_name: XMP
| | content_type: application/rdf+xml
| | content_encoding:
| | hidden item: false
|
| Box: iref -----
| size: 40 (header size: 12)
| reference with type 'cdsc' from ID: 2 to IDs: 1
| reference with type 'cdsc' from ID: 3 to IDs: 1
|
| Box: iprp -----
| size: 791 (header size: 8)
| | Box: ipco -----
| | size: 759 (header size: 8)
| | | index: 1
| | | Box: ispe -----
| | | size: 20 (header size: 12)
| | | image width: 256
| | | image height: 256
| | |
| | | index: 2
| | | Box: pixi -----
| | | size: 16 (header size: 12)
| | | bits_per_channel: 8,8,8
| | |
| | | index: 3
| | | Box: av1C -----
| | | size: 12 (header size: 8)
| | | version: 1
| | | seq_profile: 1
| | | seq_level_idx_0: 0
| | | high_bitdepth: 0
| | | twelve_bit: 0
| | | chroma_subsampling_x: 0
| | | chroma_subsampling_y: 0
| | | chroma_sample_position: 0
| | | initial_presentation_delay: not present
| | | config OBUs:
| | |
| | | index: 4
| | | Box: colr -----
| | | size: 684 (header size: 8)
| | | colour_type: prof
| | | profile size: 672
| | |
| | | index: 5
| | | Box: colr -----
| | | size: 19 (header size: 8)
| | | colour_type: nclx
| | | colour_primaries: 2
| | | transfer_characteristics: 2
| | | matrix_coefficients: 6
| | | full_range_flag: 1
| |
| | Box: ipma -----
| | size: 24 (header size: 12)
| | associations for item ID: 1
| | | property index: 1 (essential: false)
| | | property index: 2 (essential: false)
| | | property index: 3 (essential: true)
| | | property index: 4 (essential: false)
| | | property index: 5 (essential: false)
I see a similar effect using the --mini option:
$ ~/coding/libavif/build/avifenc --mini complex_osm_tile_alpha.png complex_osm_tile_alpha_mini.avif
Successfully loaded: complex_osm_tile_alpha.png
AVIF to be written: (Lossy)
* Resolution : 256x256
* Bit Depth : 8
* Format : YUV444
* Alpha : Not premultiplied
* Range : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile : Present (672 bytes)
* XMP Metadata : Present (3426 bytes)
* Exif Metadata : Present (208 bytes)
* Transformations: None
* Progressive : Unavailable
Encoding with codec 'aom' speed [6], color quality [60 (Medium)], alpha quality [100 (Lossless)], tileRowsLog2 [0], tileColsLog2 [0], 16 worker thread(s), please wait...
Encoded successfully.
* Color total size: 0 bytes
* Alpha total size: 0 bytes
Wrote AVIF: complex_osm_tile_alpha_mini.avif
Dumping that out, I see:
Box: ftyp -----
size: 16 (header size: 8)
major brand: mif3
minor version: avif
compatible brands:
Box: mini -----
size: 10794 (header size: 8)
version: 0
explicit_codec_types_flag: 0
float_flag: 0
full_range_flag: 1
alpha_flag: 0
explicit_cicp_flag: 0
hdr_flag: 0
icc_flag: 1
exif_flag: 1
xmp_flag: 1
chroma_subsampling: 3
orientation: 1
width: 256
height: 256
bit_depth: 8
colour_primaries: 2
transfer_characteristics: 2
matrix_coefficients: 6
Metadata
Metadata
Assignees
Labels
No labels