Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AddThumbnail(byte[] data) to ExifProfile #605

Open
gerwintmg opened this issue Apr 8, 2020 · 3 comments
Open

AddThumbnail(byte[] data) to ExifProfile #605

gerwintmg opened this issue Apr 8, 2020 · 3 comments

Comments

@gerwintmg
Copy link

Is your feature request related to a problem? Please describe

I'm using Magick.net to update Exif metadata, but could not find a way, to replace the thumbnail image.

Describe the solution you'd like

I would like to be able to replace the thumbnail, by using magick.net

Describe alternatives you've considered

I have tried to make an extension method but did not find a way to add the thumbnail image data.

ImageMagick.ExifProfile exifProfile = image.GetExifProfile();
exifProfile = (null == exifProfile) ? new ImageMagick.ExifProfile() : exifProfile;
exifProfile.RemoveThumbnail();

exifProfile.SetValue(ExifTag.JPEGInterchangeFormat, ""); // ThumbnailOffset 
exifProfile.SetValue(ExifTag.JPEGInterchangeFormatLength, ""); // ThumbnailLength
@dlemstra
Copy link
Owner

At this moment there is no support for adding thumbnails. The code that creates the byte array that is passed to ImageMagick does not write the thumbnail at the moment. It might be possible but I will need to investigate that.

@Kjelldor
Copy link

If I were to look into adding this as a feature (since I need it myself), what would be a good place to start looking?

@dlemstra
Copy link
Owner

Thanks for offering to help me with this @Kjelldor. To add this functionality changes need to be made to the following classes:

ExifProfile => A new method should be added that can be used to add the thumbnail to the profile. The input argument should probably be an (IMagickImage) that is then converted to a byte array with MagickFormat.Jpeg that is probably stored on the ExifData.
ExifWriter => This should be changed to add the thumbnail directory and data to the end of the profile. This will probably require changing some internal arguments. This is probably the most difficult part and I would advise you to check the exif specs to see how that should be added.

Feel free to reach out if you need more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants