c# - Remove all metadata from common image formats? -


i'm writing service project that's going handle our image processing. 1 such process supposed strip metadata byte[] provided , return same image byte[].

the method i'm working on involves converting image bitmap, converting original format , returning data memorystream.

i haven't been able test yet tells me i'm going experience quality loss.

how can remove metadata image common format?

(bmp, gif, png, jpg, icon, tiff)

not sure how can narrow down further. nice if got feedback regarding downvotes.

for lossless formats (except jpeg), idea of loading bitmap , re-saving fine. not sure if .net natively supports tiffs (i doubt does).

for jpegs, suggested there may quality loss if you're re-compressing file after decompressing it. that, might try exiflibrary , see if has anything. if not, there command line tools (like imagemagick) can strip metadata. (if use imagemagick, you're set, since supports of required formats. command want convert -strip.)

for tiffs, .net has built-in tiffbitmapdecoder , ...encoder classes might able use; see here.

in short, using external tool imagemagick easiest solution. if can't use external tool, you're going need special-case formats .net doesn't support natively (and lossy jpeg).

edit: read imagemagick doesn't lossless stripping jpegs, sorry. guess using library linked above, or other jpeg library, best can think of.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -