Feture request: BPG image format

Started by kociaczek, July 05, 2016, 04:47:19 AM

Previous topic - Next topic

kociaczek

Dear Phil,

I'd like to request a support for BPG image format. The text specification for BPG and sample files can be found here: http://bellard.org/bpg/. BPG supports EXIF, ICC and XMP metadata.

At the moment exiftool detects BPG files which contain metadata as TIFF with unknown header (the metadata are recognized properly).

ExifTool Version Number         : 9.46
File Name                       : _DSC0107.bpg
Directory                       : .
File Size                       : 4.8 MB
File Modification Date/Time     : 2016:06:12 13:39:02+02:00
File Access Date/Time           : 2016:06:14 18:55:30+02:00
File Inode Change Date/Time     : 2016:06:16 09:10:00+02:00
File Permissions                : rwxrwxrwx
Warning                         : Skipped unknown 18 byte header
File Type                       : TIFF
MIME Type                       : image/tiff
Exif Byte Order                 : Little-endian (Intel, II)
...



BPG fles without metadata are not detected.

ExifTool Version Number         : 9.46
File Name                       : 003.bpg
Directory                       : .
File Size                       : 83 kB
File Modification Date/Time     : 2016:07:05 10:50:30+02:00
File Access Date/Time           : 2016:07:05 10:50:26+02:00
File Inode Change Date/Time     : 2016:07:05 10:50:30+02:00
File Permissions                : rwxrwxrwx
Error                           : Unknown file type


Best regards,
Maciej Trochimiuk

Phil Harvey

Hi Maciej,

I can't find a bpg sample with metadata.  Can you provide a link?  (preferably both EXIF and XMP)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kociaczek

Hi Phil,

Glad to hear youy're about to add this feature.
The following link contains three BPG files, each made with different device with different metadata.

https://ns375149.ip-5-196-88.eu/bpg_samples.zip

Regards,
Maciej


Phil Harvey

Hi Maciej,

Thanks.  I'll look into adding support for this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Unfortunately I have some problems:

1) The metadata samples you provided contain only EXIF metadata (I also need XMP and ICC_Profile samples).

2) The samples you provided do not follow the standard.  There is an extra undocumented zero byte at the start of the EXIF data.  I have no way of knowing if the specification is outdated, or the samples are written incorrectly.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kociaczek

These files were obtained by transcoding JPEG files with the BPG reference software, which is supposed to keep the metadata. There my be some incoherence between the text specification and the reference software. I'll check this out.

Regards,
Maciej

Phil Harvey

#6
I've downloaded the encoder to try this myself.  There are problems here too:

1. It doesn't compile on my Linux machine (Linux 2.6.32-573.8.1.el6.x86_64 x86_64, gcc 4.4.7).

2. It doesn't compile on my Mac (OS X 10.10.5, gcc 4.2.1, Apple LLVM 7.0.2), but I was able to hack the makefile to get it to build.

3. The bpgenc utility crashes on small (8x8) images (the BPG web encoder also fails with these images).

4. The bpgenc utility doesn't seem to copy any metadata to the output BPG image (ditto the BPG web encoder). (It does if you add the -keepmetadata option.)

Bottom line: This specification/library is not ready for prime-time use. :(

- Phil

Edit: Discovered the -keepmetadata option (it helps to read the documentation).  With this I have been able to generate samples with EXIF, XMP and ICC.  The extra byte only occurs for EXIF, and is because bpgenc copies the padding byte after the "EXIF\0" APP1 header.  In my opinion, this is incorrect.  If this byte is not copied then the EXIF data will start with the TIFF header (beginning with "II" or "MM"), which makes much more sense.  I tried to submit a bug report about this, but couldn't find where to submit bugs for libbpg.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I have just released version 10.22 with support for reading BPG metadata.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

For what it's worth, attached is a patch for libbpg that fixes the extra padding byte at the start of the EXIF data.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Marsu42

Quote from: Phil Harvey on July 05, 2016, 11:55:21 AM
I tried to submit a bug report about this, but couldn't find where to submit bugs for libbpg.[/i]

It seems you can publish a pull request here: https://github.com/mirrorer/libbpg
Or you can mail the dev: https://thomash.fr/

I felt free to mail him just now about your patch, let's hope he speaks English :-p