Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Read exif chunk from a PNG image #475

Closed
Ciruman opened this issue May 8, 2020 · 5 comments
Closed

Read exif chunk from a PNG image #475

Ciruman opened this issue May 8, 2020 · 5 comments

Comments

@Ciruman
Copy link
Contributor

Ciruman commented May 8, 2020

Since 2017, PNG supports eXIf chunk. The content is described here:

3.7. eXIf Exchangeable Image File (Exif) Profile

I tried to read the exif metadata of an image by making use of the following methods without success:
ImageMetadataReader.readMetadata
or:
PngMetadataReader.readMetadata

I had a try with the following steps:

  1. Make use of the method extract from the class PngChunkReader with a PngChunkType eXIf

  2. Give the content found in the previous step to the method processIfd in the class TiffReader

All metadata was extracted from a PNG image without a problem.

Is there any plan to support PNG eXIf chunks?

Is there any interest in the implementation of it?

I analyzed the images with the tools ExifTool and ImageMagick and they were able to read/write the PNG images.

@drewnoakes
Copy link
Owner

@Ciruman can you provide a sample PNG image that contains Exif data?

Would you like to submit a PR for this?

@Ciruman
Copy link
Contributor Author

Ciruman commented May 13, 2020

Yes, I will provide a sample image and I will try to create a PR for this. :-)

@Ciruman
Copy link
Contributor Author

Ciruman commented May 21, 2020

@drewnoakes The sample image can be found here:
https://we.tl/t-OFOvimwd91
The image used was:
https://github.com/drewnoakes/metadata-extractor/blob/master/Tests/Data/dotnet-256x256-alpha-palette.png
And the exif data was added using https://github.com/dlemstra/Magick.NET/
The output using exiftool is:

❯ exiftool sampleWithExifData.png
ExifTool Version Number         : 11.85
File Name                       : sampleWithExifData.png
Directory                       : .
File Size                       : 12 kB
File Modification Date/Time     : 2020:05:21 21:46:15+02:00
File Access Date/Time           : 2020:05:21 21:47:03+02:00
File Inode Change Date/Time     : 2020:05:21 21:46:19+02:00
File Permissions                : rw-rw-rw-
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 256
Image Height                    : 256
Bit Depth                       : 8
Color Type                      : Palette
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Gamma                           : 2.2
White Point X                   : 0.3127
White Point Y                   : 0.329
Red X                           : 0.64
Red Y                           : 0.33
Green X                         : 0.3
Green Y                         : 0.6
Blue X                          : 0.15
Blue Y                          : 0.06
Palette                         : (Binary data 720 bytes, use -b option to extract)
Background Color                : 0
Modify Date                     : 2020:05:20 19:37:26
Exif Byte Order                 : Little-endian (Intel, II)
Copyright                       : Acme
Software                        : Acme-software: 1.0.0.0
Image Description               : This is an image with exif data
Maker Note Unknown Text         : This is an example of markernotes
Warning                         : [minor] Text chunk(s) found after PNG IDAT (may be ignored by some readers)
Datecreate                      : 2020-05-20T19:37:26+00:00
Datemodify                      : 2020-05-20T19:37:26+00:00
Image Size                      : 256x256
Megapixels                      : 0.066

I am preparing the PR but I thought it is a good idea if you can have a look to the image first.

drewnoakes added a commit to drewnoakes/metadata-extractor-images that referenced this issue May 21, 2020
@drewnoakes
Copy link
Owner

@Ciruman thanks for the image. I've added it to the library so that we have a baseline for changes from your PR.

@Ciruman
Copy link
Contributor Author

Ciruman commented Jun 3, 2020

Pull request: #481

@Ciruman Ciruman closed this as completed Jun 3, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants