LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.4k stars 301 forks source link

[Enhancement] Read PNG Metadata #363

Closed joserick closed 4 years ago

joserick commented 5 years ago

Hi!,

I am currently finishing a project to extract PNG metadata because Lychee-Laravel used "iptcparse" and "exif_read_data" to extract metadata from JPEG images, but these are not compatible with PNG, so I want to add the new code as a complement from Composer to Lychee-Laravel since the code is very long and requires subclasses and would look very rough inside "app / Metadata / Extractor.php"

which leads us to the magic question, would you allow me to make this contribution from an external complement and thus be used by other projects?

MetadataPNG

regards.

kamil4 commented 5 years ago

Do you know by any chance if exiftool supports the PNG metadata? Because we are planning to add exiftool support in the future...

In general, I don't think adding Composer dependencies is a problem; we have a number of them already...

ildyria commented 5 years ago

ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in a wide variety of files. ExifTool supports many different metadata formats including EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3, as well as the maker notes of many digital cameras by Canon, Casio, DJI, FLIR, FujiFilm, GE, GoPro, HP, JVC/Victor, Kodak, Leaf, Minolta/Konica-Minolta, Motorola, Nikon, Nintendo, Olympus/Epson, Panasonic/Leica, Pentax/Asahi, Phase One, Reconyx, Ricoh, Samsung, Sanyo, Sigma/Foveon and Sony.

Supports alternate language tags in XMP, PNG, ID3, Font, QuickTime, ICC Profile, MIE and MXF information

I guess it does support PNG.

ildyria commented 5 years ago

Personally I think I would rather add the support of Exiftool but that may be an interesting alternative. :)

joserick commented 5 years ago

Hi,

ExifTool is an excellent option, more if in the future Lychee supports images with format .bmp and .webp.

I would recommend PHPExiftool is a excellent option.

On the other hand, my png-metadata project still has many unresolved details, but it is already stable enough to upload. PNGMetadata

My objective is to not require of the ExifTool program and be completely native but anyway I am based on the ExifTool code but unfortunately it is written in 'Perl' which delays many.

Here other option: exiftool-reader

kamil4 commented 5 years ago

Sorry for the delay in responding. Yes, given the restricted availability of exifool in shared hosting environments, etc, I think that having an alternative that does not require launching external binaries does have value. So I would encourage you to continue working on this and submit a PR when you're ready.

Regarding the exiftool support: we are planning to provide it but, as far as I know, nobody is working on it right now. So, again, contributions are welcome :smiley:.

There is an initial attempt at https://github.com/hermzz/Lychee-Laravel/commit/386474dd12c486192eb118983f53dcf8164cd6a4 but it's apparently incomplete. It uses PHPExif rather than the package you referred to. I have no experience with either but before we move forward, it would be good to reach a consensus on which one we should be using.

d7415 commented 5 years ago

fwiw, PHPExiftool: 1) appears to just be a wrapper, so it still calls the external binary 2) states clearly that it's not suitable for production use

kamil4 commented 5 years ago

I think they are all wrappers. exiftool is written in perl so I don't suppose there's any way to avoid invoking it and parsing its output?

As to the production use, https://packagist.org/?query=exiftool clearly shows that PHPExiftool is quite popular, although PHPExif appears to be used even more...

d7415 commented 5 years ago

Well, yes. PHPExiftool actually says

This driver is not suitable for production, it is still under heavy development.

Though the "heavy development" is questionable and the original repo seems to have vanished somewhere.

PHPExif is also pre-v1 but doesn't have the same caveat attached.

tmp-hallenser commented 5 years ago

The original repo has just moved: Original repo: https://github.com/romainneutron/PHPExiftool Fork: https://github.com/alchemy-fr/PHPExiftool (<- seems to be the successor)

I gave the latter a try today, but the dependency requirements are not up-to-date. Lychee uses symfony/console 4.X and symfony/process 4.X while PHPExiftool requires both versions <= 3.0 -> I've created an issue to the respective repo.

Edit: There is an alternative to the above mentioned repos: https://github.com/PHPExif/php-exif

kamil4 commented 5 years ago

@tmp-hallenser See my comment https://github.com/LycheeOrg/Lychee-Laravel/issues/363#issuecomment-545507833 above, specifically the last paragraph...

tmp-hallenser commented 4 years ago

401 should fix this one