For some image types, it is a simple matter of passing to the library the limits Emacs wants to set. For libpng, we could use png_set_user_limits() to set our maximum width/height. (libpng also has a built-in default limit of 1 million pixels in both dimensions.)
For other libraries, the application can set the maximum amount of memory to allocate, see for example libjpeg's `max_memory_to_use' and `max_alloc_chunk'. Getting things right for all image types will probably be tricky... If we handle them one by one, it won't be terribly tricky. We could have one limit for memory size of an image, and another limit for the width and height as a ratio to those of the window. Then for each image type it would use whichever of those can be used. Would you like to implement this for some image types for which it is easy to do? Then we could ask the developers of the other libraries to add similar features. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel