You are here

Iconify.scm Where did it go?

Once there was a wonderful iconify.scm and after the latest Gimp came out it vanished... when I took ano old copy from a previous version and placed it into the newer one it wouldn't work. I really need this. Can someone find Iconify.scm and fix it for current verions. Many thanks :)

if you post that script (or a link for the script) with the error messages you got when you try to run it on some gimp forum or group (gimp user group on flickr, Gimptalk.com,..) you may get more chance to find somebody willing to correct it Or to check if someone already did, not all available scripts are listed here

The previously mentioned broken Iconify script has been fixed for GIMP 2.4.6 :D See: http://registry.gimp.org/files/iconify2.scm Shouts go out to Ouch67, PhotoComix, and Giuseppe Bilotta #Cheers, Gargs

Found a copy of Iconify.scm , posing the script below along with the error I get when using it. It would be much appreciated if someone would "repair/fix" it to work with Gimp 2.4.6 + , Many thanks Iconify plug-in converts a single layer of a single image into a multi-layered image ready to be saved as a Windows icon. The new image will contain all standard sizes (16x16, 32x32, 48x48) at all standard bit depths (16 colors, 256 colors, 32-bit RGBA), with transparency support. Requirements: # Script-Fu # GIMP Original coder may have been Giuseppe Bilotta but can't confirm. ----------------------------------------------------- "C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts\iconify.scm" GiMP 2.4.6 Iconify Message Error while executing (script-fu-iconify 22 44) Error: set!: ubound variable:new-img ----------------------------------------------------------------- ; This is my first plugin. ; It converts an image into a Windows/Macintosh icon (define (script-fu-iconify img drawable) ; Create a new image. We size it to 256x256 to allow for ; the future Windows Vista icons; it's also easy to add ; 128x128 Macintosh icons, or other sizes ; TODO make the sizes (and depths) parameters to the function (set! new-img (car (gimp-image-new 256 256 0))) ; Set the name of the new image by replacing the extension with .ico ; FIXME this doesn't work as intended for files without extension ; or files with multiple extensions. (set! new-name (append (butlast (strbreakup (car (gimp-image-get-filename img)) ".") ) '(".ico") ) ) (set! new-name (eval (cons string-append new-name))) (gimp-image-set-filename new-img new-name) ; Create a new layer (set! work-layer (car (gimp-layer-new-from-drawable drawable new-img))) ; Give it a name (gimp-layer-set-name work-layer "Work layer") ; Add the new layer to the new image (gimp-image-add-layer new-img work-layer 0) ; Autocrop the layer (plug-in-autocrop-layer 1 new-img work-layer) ; Now, resize the layer so that it is square, ; by making the shorter dimension the same as ; the longer one. The layer content is centered. (set! layer-x (car (gimp-drawable-width work-layer))) (set! layer-y (car (gimp-drawable-height work-layer))) (set! max-dim (max layer-x layer-y)) (gimp-layer-resize work-layer max-dim max-dim (/ (- max-dim layer-x) 2) (/ (- max-dim layer-y) 2) ) ; Move the layer to the origin of the image (gimp-layer-set-offsets work-layer 0 0) ; Now, we create as many layers as needed, resizing to ; 16x16, 32x32, 48x48, 128x128, 256x256 (define (resize-to-dim dim) (set! temp-layer (car (gimp-layer-copy work-layer 0))) (gimp-image-add-layer new-img temp-layer 0) (gimp-drawable-transform-scale temp-layer 0 0 dim dim 0 2 1 3 0) ) ; We don't do the two biggest sizes, for now ; TODO make this a parameter (mapcar resize-to-dim '(16 32 48) ) ; We can now get rid of the working layer (gimp-image-remove-layer new-img work-layer) ; These two functions allow us to create new layers which are ; clones of the existing ones but at different color depths. ; We have to use two functions and pass through intermediate ; images because otherwise the second color reduction would dupe ; the layers, thus giving an unneeded extra set of layers ; TODO a potential study should be done on whether it's better ; to go straight to the lowest number of color (as we do), or ; passing through intermediate number of colors. ; Observe that no dithering is done. This is intentional, since ; it gives the best results. (define (palettize-image pal-type num) (set! temp-img (car (gimp-image-duplicate new-img))) (gimp-image-convert-indexed temp-img 0 pal-type num 0 1 "") temp-img) (define (plop-image temp-img) (set! layers (gimp-image-get-layers temp-img)) (set! layernum (car layers)) (set! layers-array (cadr layers)) (while (> layernum 0) (set! layer (car (gimp-layer-new-from-drawable (aref layers-array (- layernum 1)) new-img) ) ) (gimp-image-add-layer new-img layer 0) (set! layernum (- layernum 1)) ) ) ; The 256 color image, using an optimized palette (set! eigth-bit (palettize-image 0 256)) ; The 16 color image, using the 'official' 'web' optimized palette ; It must be done with that palette because otherwise we can't ; save to 16-color in Windows .ico format (set! four-bit (palettize-image 2 16)) ; Now we put the new layers back in the original image (plop-image eigth-bit) (plop-image four-bit) ; We display the new image (gimp-display-new new-img) ; And we flush the display (gimp-displays-flush) ) ; TODO the plugin currently only works with truecolor images ; it could be extended to work with palettized images, thus only creating ; layers for depths up to the current image depth (script-fu-register "script-fu-iconify" "/Script-Fu/Utils/Iconify" "Use the current layer of the current image to create a multi-sized, multi-depth Windows icon file" "Giuseppe Bilotta" "Giuseppe Bilotta" "20051021" "RGB*" SF-IMAGE "Image to iconify" 0 SF-DRAWABLE "Layer to iconify" 0)
Subscribe to Comments for "Iconify.scm Where did it go?"