Wikipedia needs a -metastrip flag for convert

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
kaldari

Wikipedia needs a -metastrip flag for convert

Post by kaldari »

Wikipedia (and all Wikimedia projects) currently use convert -thumbnail for resizing uploaded images for display in articles and image pages. The -thumbnail flag, however, not only resizes the image, but also strips the metadata and the color profile (similar to the -strip flag). Since "thumbnails" are the main way in which Wikipedia images are viewed, ideally we would like to retain the color profile information (so that Van Gogh's sunflowers don't look like daisies). The only solution that we know of would be to switch to using -resize instead of -thumbnail, however, this leaves all the metadata which can double the size of the file.

What we would like, ideally, is for convert to have a new flag that is identical to -strip, but leaves the color profile, i.e. only strips the metadata. Perhaps something like "-metastrip". Then we could use convert -metastrip -resize to generate all our images.

The MediaWiki bug discussing this issue can be found at https://bugzilla.wikimedia.org/show_bug.cgi?id=19960.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Wikipedia needs a -metastrip flag for convert

Post by magick »

We will add a patch to the next ImageMagick point release such that -thumbnail removes all profiles except the color profile. Look for it in about a week or two. Thanks.
kaldari

Re: Wikipedia needs a -metastrip flag for convert

Post by kaldari »

Wow, that's even better! Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Wikipedia needs a -metastrip flag for convert

Post by fmw42 »

Sorry to poke my head into this. But I might suggest that this be thought out a bit more. I suspect many users like the fact that -thumbnail strips everything so as to get a minimum size result. Perhaps it might be better to use a -set option to permit maintaining the color profile. That way it maintains backward compatibility. Just a suggestion.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Wikipedia needs a -metastrip flag for convert

Post by Bonzo »

I agree with Fred, I like -thumbnail to strip everything it can to reduce image size and I think that should be the default setting.

There must be a lot of users using -thumbnail for this purpose and it will be quite an effort to change code that has been written some time. I have been involved in 4 website that would need to be changed. Other users could have even more.
kaldari

Re: Wikipedia needs a -metastrip flag for convert

Post by kaldari »

Why would you ever want the color profile stripped out? It only takes up about 3K and makes sure that your thumbnails are displayed in the same colors as the original file. Isn't that worth 3K? Leaving the color profile in by default makes sense to me. I think most people would value having their images display accurately over saving 3K of memory, but it probably depends on if you're talking to programmers or photographers ;)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Wikipedia needs a -metastrip flag for convert

Post by magick »

Leaving the color profile in by default makes sense to me.
We agree. The fix will be available later this week with the ImageMagick 6.5.4-7 point release. To get the prior behavior just use this command:
  • convert image.jpg -thumbnail 120x120 -strip thumbnail.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Wikipedia needs a -metastrip flag for convert

Post by fmw42 »

Point taken and at least there is a fall back to past behavior.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Wikipedia needs a -metastrip flag for convert

Post by anthony »

I have noted this as a version "WARNING" note in both "thumbnail" and "resize" sections of IM Examples where "-thumbnail" is introduced.

Question; would such a color profile be saved to GIF or PNG images?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply