Home > Hacking Invenio > WebSubmit Internals > Icon creation tools |
The WebSubmit Icon Creator library (websubmit_icon_creator.py) handles icon creation based on existing fulltext files.
def create_icon(options): """The driver for the icon creation process. This is effectively the function that is responsible for coordinating the icon creation. It is the API for the creation of an icon. @param options: (dictionary) - a dictionary of options that are required by the function in order to carry out the icon-creation process. The dictionary must have the following structure: + input-file: (string) - the path to the input file (i.e. that which is to be stamped; + icon-name: (string) - the name of the icon that is to be created by the program. This is optional - if not provided, a default name will be applied to the icon file instead; + multipage-icon: (boolean) - used only when the original file is a PDF or PS file. If False, the created icon will feature ONLY the first page of the PDF. If True, ALL pages of the PDF will be included in the created icon. Note: If the icon type is not gif, this flag will be forced as False. + multipage-icon-delay: (integer) - used only when the original file is a PDF or PS AND use-first-page-only is False AND the icon type is gif. This allows the user to specify the delay between "pages" of a multi-page (animated) icon. + icon-scale: ('geometry') - the scaling information to be used for the creation of the new icon. Type 'geometry' as defined in ImageMagick. (eg. 320 or 320x240 or 100> or 5%) + icon-file-format: (string) - the file format of the icon that is to be created. Legal values are: * pdf * gif * jpg * jpeg * ps * png * bmp + verbosity: (integer) - the verbosity level under which the program is to run; So, an example of the returned dictionary could be something like: { 'input-file' : "demo-picture-file.jpg", 'icon-name' : "icon-demo-picture-file", 'icon-file-format' : "gif", 'multipage-icon' : True, 'multipage-icon-delay' : 100, 'icon-scale' : 180, 'verbosity' : 0, } @return: (tuple) - consisting of two strings: 1. the path to the working directory in which all files related to icon creation are stored; 2. The name of the "icon" file; @Exceptions raised: (InvenioWebSubmitIconCreatorError) be raised or propagated by this function when the icon creation process fails for one reason or another. """
See websubmit_icon_creator API for a complete API description.