jwagner / smartcrop.js

Content aware image cropping

Home Page:http://29a.ch/2014/04/03/smartcrop-content-aware-image-cropping

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smartcrop removing JPEG metadata

mrzool opened this issue · comments

Thanks again for this great tool.

As of now, Smartcrop strips all EXIF, IPTC, etc.. metadata from the files it crops. It would be nice to have an option to keep these metadata. Is there any chance to see this implemented?

@mrzool Smartcrop itself doesn't modify the image at all, it just recommends crops. Whether meta data gets added to the crop that is being generated depends on how the crop is generated. In the browser it requires quite a bit of code to copy exif data along (either a custom JPEG encoder or likely the better option something that just adds the APPN segments back to the resulting jpeg.

Long story short, it's possible but it doesn't belong into smartcrop itself and should be implemented in a separate library in my opinion.

For posterity, I was able to achieve this by using ExifTool.

First I crop all the images with smartcrop and put all the crops in the subdirectory crops.

Then I copy all the metadata from the original files over to the cropped files with this ExifTool command:

exiftool -v -tagsfromfile ./%f.%e -ext jpg crops/

EDIT: I omitted to say I was using the command line interface, sorry about that.