oozcitak / exiflibrary

A .Net Standard library for editing Exif metadata
MIT License
131 stars 48 forks source link

JFIF segment is wrong? #72

Closed ziriax closed 4 years ago

ziriax commented 4 years ago

The JFIF APP0 segment has a fixed layout (https://www.w3.org/Graphics/JPEG/jfif.txt)

However, it seems the code doesn't deal with that, it just outputs the JFIF properties as found. This never seems to produce the correct JFIF APP0 segment.

See WriteJFIFApp0

I must be missing something?

It seems the code only works correctly when a JFIF segment was already present in the JPEG file, otherwise it is wrong?

oozcitak commented 4 years ago

I added checks to correct an incomplete JFIF segment if there is at least one JFIF tag.

Also the code will remove the JFIF segment completely if there are no JFIF tags (same for JFXX).

So we either have a fixed length JFIF segment or no JFIF segment at all.