Here are a few proposed tweaks to IM core based on my own internal modifications:
- CORE_png / pngvalid.c: interferes with the running of Boost test since it defines an int main(). Recommend removing 'pngvalid.c' from the default build. OpenCV has already removed the file from their build. Reference: http://stackoverflow.com/q/12165121/882436
- CORE_zlib / deflate.c: modify TOO_FAR macro based on logic in accordance with this: http://optipng.sourceforge.net/pngtech/too_far.html Since IM is an image library rather than a text library, the modification is a no-brainer IMO.
- CORE_magick / threshold.c, OrderedPosterizeImageChannel
The logic within this function requires an external XML file, which results in lower performance, conflicts with my static build and complicates my deployment. Recommend hard-coding the default threshold maps, while still allowing the use of the external XML file for custom-defined threshold maps. Here is the code I'm using starting at line 1459:
Code: Select all
//map = GetThresholdMap(token, exception);
// TC
// hard code threshold map so we don't have to parse xml
map = (ThresholdMap *)AcquireMagickMemory(sizeof(ThresholdMap));
if ( map == (ThresholdMap *)NULL )
ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireThresholdMap");
map->map_id = ConstantString("threshold");
map->description = ConstantString("");
map->width = 1;
map->height = 1;
map->divisor = 2;
map->levels=(ssize_t *) AcquireQuantumMemory((size_t) map->width,map->height * sizeof(*map->levels));
if ( map->levels == (ssize_t *)NULL )
ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireThresholdMap");
map->levels[0] = 1;
// end tc
if ( map == (ThresholdMap *)NULL ) {
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"InvalidArgument","%s : '%s'","ordered-dither",threshold_map);
return(MagickFalse);
Thanks in advance!