For a project I am extensively using MSL to alter images on the fly in a web based environment. It is desirable to be able to optimize the file size of an image as losslessly as possible, something like `convert file -strip file` or `convert file +profile "*" file` from within MSL.
MSL does not have a "strip" tag, however it does have a "profile" tag which is broken as far removing profiles is concerned.
Code: Select all
/*
From msl.c, line 4314
*/
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i]);
CloneString(&value,attribute);
if (*keyword == '+')
{
/*
Remove a profile from the image.
*/
(void) ProfileImage(msl_info->image[n],keyword,
(const unsigned char *) NULL,0,MagickTrue);
continue;
}
Code: Select all
<profile +remove="arbitrary" />
possible solutions:
- Have an add_profile and a remove_profile tag which work like <add_profile profile="whatever" /> and <remove_profile profile="*" />
- Retool the profile tag to work like <profile some_profile="-" some_other="+" ... /> where "+" and "-" represent add or remove and a special attribute "all" exists which is equivalent to "*"
- Have attributes "add" and "remove" which accept comma-separated profiles to add or remove like <profile add="a,b,c" /> and <profile remove="*" />
- Leave profile adding functionality as is and implement a "remove" attribute which removes a given profile or comma-separated list of profiles
Code: Select all
/*
msl.c, line 4314
*/
keyword=(const char *) attributes[i++];
attribute=InterpretImageProperties(msl_info->image_info[n],
msl_info->attributes[n],(const char *) attributes[i]);
CloneString(&value,attribute);
if (LocaleCompare(keyword, "remove") == 0)
{
/*
Remove a profile from the image.
*/
(void) ProfileImage(msl_info->image[n],attribute,
(const unsigned char *) NULL,0,MagickTrue);
continue;
}
Code: Select all
<profile remove="*" />
Please consider using my patch or implementing a way to remove profiles in MSL.
Thank you.