libpng warning: eXIf: duplicate - what does it mean?
Ben Bullock <[email protected]> Fri, 11 Dec 2020 15:03:20 +0900
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CAN5Y6m-1=WGF13wizSnky7sbWkhn1FRmp1Cio=cN7qpag5JsiA@mail.gmail.com> |
I am trying to implement the eXIf chunk for a Perl module,
Image::PNG::Libpng.
Here is my code so far:
static SV *
perl_png_get_eXIf (perl_libpng_t * png)
{
SV * exif = & PL_sv_undef;
#ifdef PNG_eXIf_SUPPORTED
if (VALID (eXIf)) {
png_uint_32 num_exif;
png_bytep exif_buf;
png_get_eXIf_1 (png->png, png->info, & num_exif, & exif_buf);
exif = newSVpvn ((const char *) exif_buf, (STRLEN) num_exif);
}
#else /* PNG_eXIf_SUPPORTED */
UNSUPPORTED (eXIf);
#endif /* PNG_eXIf_SUPPORTED */
return exif;
}
static void
perl_png_set_eXIf (perl_libpng_t * png, SV * exif)
{
#ifdef PNG_eXIf_SUPPORTED
png_uint_32 num_exif;
png_bytep exif_buf;
STRLEN exif_len;
exif_buf = (png_bytep) SvPV (exif, exif_len);
num_exif = (png_uint_32) exif_len;
png_set_eXIf_1 (png->png, png->info, num_exif, exif_buf);
#else /* PNG_eXIf_SUPPORTED */
UNSUPPORTED (eXIf);
#endif /* PNG_eXIf_SUPPORTED */
}
In my test, I have this code:
my $png = read_png_file ("$Bin/tantei-san.png");
my $noexif = $png->get_eXIf ();
ok (! defined $noexif, "Got undefined from file with no exif");
my $wpng = copy_png ($png);
my $exif = "MM random garbage";
$wpng->set_eXIf ($exif);
my $file = "$Bin/exif.png";
rmfile ();
$wpng->write_png_file ($file);
my $rpng = read_png_file ($file);
#rmfile ();
my $roundtrip = $rpng->get_eXIf ();
is ($roundtrip, $exif, "Round trip of eXIf chunk");
This is working but I am getting a warning of the form
libpng warning: eXIf: duplicate after the line "read_png_file" and before
the test of the round trip. As can be seen from the first test (the initial
ok (!defined $noexif)), there is no eXIf chunk in the initial file.
What could be causing this error?
_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement