Image icon indicating copy to clipboard operation
Image copied to clipboard

resize does not preserve metadata

Open pozar87 opened this issue 8 years ago • 7 comments

Hello, Im not yet quite sure if this is a bug or project decision but It looks like images metadata are lost in a process of resize. The generated miniature jpeg file have a very limited data set. For instance:

exiftool source.jpg
ExifTool Version Number         : 10.00
File Name                       : source.jpg
Directory                       : .
File Size                       : 44 kB
File Modification Date/Time     : 2015:11:14 21:26:53+01:00
File Access Date/Time           : 2015:11:14 21:26:53+01:00
File Inode Change Date/Time     : 2015:11:14 21:26:53+01:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Orientation                     : Rotate 90 CW
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : fw 05.25 prm 05.33
Modify Date                     : 2011:12:18 10:58:40
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/11
F Number                        : 2.6
Exposure Program                : Program AE
ISO                             : 160
Exif Version                    : 0220
Date/Time Original              : 2011:12:18 10:58:40
Create Date                     : 2011:12:18 10:58:40
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/11
Aperture Value                  : 2.6
Brightness Value                : 0.67
Exposure Compensation           : 0
Max Aperture Value              : 2.6
Metering Mode                   : Average
Light Source                    : Unknown
Flash                           : Off, Did not fire
Focal Length                    : 3.8 mm
Warning                         : [minor] Unrecognized MakerNotes
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 640
Exif Image Height               : 480
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : undef
Focal Length In 35mm Format     : 0 mm
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Compression                     : JPEG (old-style)
Thumbnail Offset                : 1152
Thumbnail Length                : 9337
Image Width                     : 640
Image Height                    : 480
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Aperture                        : 2.6
Image Size                      : 640x480
Megapixels                      : 0.307
Shutter Speed                   : 1/11
Thumbnail Image                 : (Binary data 9337 bytes, use -b option to extract)
Focal Length                    : 3.8 mm
Light Value                     : 5.5

while miniature has only:

exiftool mini.jpeg         
ExifTool Version Number         : 10.00
File Name                       : test.jpeg
Directory                       : .
File Size                       : 8.9 kB
File Modification Date/Time     : 2015:11:14 21:41:06+01:00
File Access Date/Time           : 2015:11:14 21:41:06+01:00
File Inode Change Date/Time     : 2015:11:14 21:41:06+01:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : inches
X Resolution                    : 96
Y Resolution                    : 96
Comment                         : CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 85.
Image Width                     : 200
Image Height                    : 150
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 200x150
Megapixels                      : 0.030

I'm not saying all meta-data should be available, but having Orientation : Rotate 90 CW would make life a bit easier. In particular I would like to use CSS on my gallery page:

image-orientation: from-image;

and simply not bother changing orientation of images before I put them into a gallery. Anyway, keep on your good work on this project!

Best Regards,

pozar87 avatar Nov 14 '15 20:11 pozar87

What do you think @Gregwar?

soullivaneuh avatar Nov 17 '15 15:11 soullivaneuh

Preserving meta is indeed a good thing Not sure the best way to achieve this though

Gregwar avatar Nov 18 '15 02:11 Gregwar

I think this should be proposed as an option and this option should be false by default for BC.

Indeed, metadata reset could be a good thing for some developers. So if we preserve it without warn them, this would be annoying.

soullivaneuh avatar Nov 18 '15 09:11 soullivaneuh

Hello, Yes, I was also wondering about BC - and additional option seems good.

Currently I solved my problem generation thumbnails with imagemagic - and it also strip all metadata (if you would like to keep orientation -auto-orient option beefer -thumbnail)

So after a second thought it seems miniatures should not have all original metadata (some are simply wrong for a minature context, while the other could be undesirable for a security reasons - i.e. geo-location), but orientation still looks like a necessary thing.

Just food for thoughts.

Best Regards,

pozar87 avatar Nov 18 '15 11:11 pozar87

I agree that this should be an option (There is also some issues, like what will happen if you use merge() methods or so)

Gregwar avatar Nov 18 '15 11:11 Gregwar

It would be nice to keep the EXIF information (especially what device the photo was originally taken with, geolocation etc). However if you edited the image with resize or other operations, some EXIF information won't make much sense anymore and could be misleading.

garygreen avatar Apr 28 '16 20:04 garygreen

The fact that the color profile is stripped out can cause processed images to display weirdly in different browsers (see this SO answer). It looks like this indeed is due to a bad default in the underlying GD library, but it would be great if at least the color space was preserved in the metadata - to prevent from washed out colors in the resulting image!

fredrikekelund avatar May 30 '16 13:05 fredrikekelund