[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#169268: marked as done (Gimp script for /CD/ menubar)



Your message dated Wed, 15 Mar 2006 01:42:57 +0100
with message-id <85EF44E9-849D-4135-B176-F6762C2E726C@witch.westfalen.de>
and subject line #169268 - Gimp script for /CD/ menubar - Debian Bug report logs
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: www.debian.org
Severity: normal

I wrote the attached script to auto-generate menubar entries in
Makefiles using the Gimp. It needs Gimp 1.2 and the
xfonts-scalable-nonfree package for the luximono font. See the top of
the script for usage instructions.

The PNGs output by this script display OK on Netscape 4.7; if the /CD/
table background colour is set to 0xdd9988, there is no colour
difference for me on a 24bpp display. Still, I wouldn't be surprised
if NS 4 still displayed things incorrectly for lower colour depths. 
For other browsers (which support PNG transparency), even a slightly
incorrect display shouldn't be noticeable.

For me, it always leaves a transparent 8 pixel wide area at the right
edge of the generated image. This isn't too much of a problem IMHO, so
I'm not trying to work around what I believe is a bug in Gimp's
string-extent measuring command.

Josip, maybe you could take care of integrating this into the
Makefiles and translation system? :-)

Cheers,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  CS student at the Technische  |  GnuPG key:
  | \/¯|  http://atterer.net  |  Universität München, Germany  |  0x888354F7
  ¯ '` ¯
;  __   _
;  |_) /|  Copyright (C) 2002 Richard Atterer
;  | \/¯|  <atterer@debian.org>
;  ¯ '` ¯
;  This program is free software; you can redistribute it and/or modify
;  it under the terms of the GNU General Public License, version 2. See
;  the file COPYING for details.

; Copy this script to ~/.gimp-1.2/scripts/ before starting the Gimp. 
; The script will become available via the menu entry
; "Xtns/Script-Fu/Debian/Debian-CD menubar".

; To create an image from the command line, use:

; gimp -i -c -d -s -b '(script-fu-debian-cd-bar "debian/rules" "-bigelow-luximono-medium-r-normal-*-*-640-*-*-p-*-iso10646-1" 130 32 "rules.png")' '(gimp-quit 0)'

; The "130" is the fontsize (13.0 pt). The luximono font is part of
; the xfonts-scalable-nonfree package (used to be called lucida mono
; in older releases). The output file is always in PNG format. The
; pink background colour is hardwired below as RGB 0xdd9988.

;======================================================================

(define (script-fu-debian-cd-bar text fontname fontsize final-height
				 filename)
  ; user variables
  ;(set! fontsize 130) ; in pt*10
  ;(set! fontname "-bigelow-luximono-medium-r-normal-*-*-640-*-*-p-*-iso10646-1")
  ;(set! fontname "-bigelow-luximono-medium-r-normal-*-*-640-*-*-p-*-iso8859-1")
  ;(set! fontname "-zz abiword-luxi mono (iso 8859 1)-medium-r-normal-*-*-640-*-*-p-*-iso8859-1")
  (set! background-colour '(221 153 136)) ; RGB 0xdd9988
  ;(set! final-height 32) ; height of output image
  ;______________________________________________________________________

  (set! border 10) ; To leave room for blurring/bumpmapping
  (set! blur-radius 5) ; For Gauß RLE blur

  ; Create canvas
  (set! image (car (gimp-image-new final-height final-height RGB)))

  ; How high/wide in pixels is the text going to be?
  (set! text-extents (gimp-text-get-extents-fontname text fontsize
                                                     POINTS fontname))
  (set! text-width (car text-extents))
  (set! text-height (cadr text-extents))
  (set! text-ascent (caddr text-extents))
  (set! text-descent (caddr (cdr text-extents)))
  ;______________________________________________________________________

  ; Create white-on-black text layer
  (set! image-width (+ text-width (* 2 border)))
  (set! image-height (+ text-height (* 2 border)))
  (if (< image-height final-height)
      (set! image-height final-height))
  (set! text-bw (car (gimp-layer-new image text-width text-height
		      RGB_IMAGE "text-bw" 100 NORMAL)))
  (gimp-image-add-layer image text-bw -1) ; at top of layer stack
  (gimp-layer-set-visible text-bw FALSE)
  (gimp-palette-set-background '(0 0 0))
  (gimp-palette-set-foreground '(255 255 255))
  (gimp-edit-fill text-bw 1) ; Fill with bg col
  ; Create text and anchor it to text-bw
  (print "  painting text - in case of error, check whether font is available")
  (gimp-floating-sel-anchor
   (car (gimp-text-fontname image text-bw 0 0 text -1 TRUE
                            fontsize POINTS fontname)))
  (print "  done")

  ; resize, adding black border around the white-on-black text
  (gimp-layer-resize text-bw image-width image-height border
		     (/ (- image-height text-height) 2) )
  (gimp-layer-set-offsets text-bw 0 0)

  (gimp-image-resize image image-width image-height 0 0)
  ;______________________________________________________________________

  ; Make copy of text-bw layer in text-blur, blur that for use as bumpmap
  (set! text-blur (car (gimp-layer-copy text-bw FALSE))) ; no alpha chan
  (gimp-layer-set-name text-blur "text-blur")
  (gimp-image-add-layer image text-blur -1) ; at top of layer stack
  (gimp-layer-set-visible text-blur FALSE)
  (plug-in-gauss-rle TRUE image text-blur blur-radius TRUE TRUE)
  ;______________________________________________________________________

  ; Create background layer
  (gimp-palette-set-background background-colour)
  (set! background (car (gimp-layer-new image image-width image-height
					RGB_IMAGE "background" 100 NORMAL)))
  (gimp-image-add-layer image background 9) ; at bottom of layer stack
  (gimp-edit-fill background 1) ; Fill with bg col
  (gimp-layer-set-visible background TRUE)

  ; Now bumpmap it with text-blur
  (plug-in-bump-map TRUE image background text-blur
		    125 20 1 ; azimuth, elevation, depth
		    0 0 0 60 ; X/Y offset, waterlevel, ambient
		    TRUE TRUE 0) ; compensate, invert map, linear map
  ;______________________________________________________________________

  ; Create another completely black layer for the final text
  (set! text (car (gimp-layer-new image image-width image-height
					RGB_IMAGE "text" 100 NORMAL)))
  (gimp-image-add-layer image text -1) ; at top of layer stack
  (gimp-layer-set-visible text TRUE)
  (gimp-palette-set-background '(0 0 0))
  (gimp-edit-fill text 1) ; Fill with bg col

  ; Add an alpha mask to that layer
  (gimp-layer-add-alpha text)
  (set! text-mask (car (gimp-layer-create-mask text 1)))
  (gimp-image-add-layer-mask image text text-mask)
  ; Copy text-bw to alpha mask
  (gimp-edit-copy text-bw)
  (gimp-floating-sel-anchor (car (gimp-edit-paste text-mask 0)))

  ;======================================================================

  ; Image is finished!

  ; Remove temporary layers
  (gimp-image-remove-layer image text-bw)
  (gimp-image-remove-layer image text-blur)

  ; Merge remaining layers
  (gimp-image-merge-visible-layers image 1) ; CLIP_TO_IMAGE

  ; Convert to indexed
  (gimp-convert-indexed image 0 0 ; dither=none, MAKE_PALETTE
			31 FALSE TRUE "")

  ; Select those parts that have the background colour, make them
  ; transparent.
  (set! background (aref (cadr (gimp-image-get-layers image)) 0))
  (gimp-fuzzy-select background 0 0 0 ; x/y, threshold
		     2 FALSE 0 0 FALSE) ; REPLACE, antialias, feath/rad, merg
  (gimp-edit-clear background)
  (gimp-selection-none image)

  ; Remove some of the border
  (set! final-width (+ text-width (* 2 blur-radius)))
  (gimp-crop image (- final-width 2) (- final-height 2)
	     (/ (- image-width final-width -2) 2)
	     (/ (- image-height final-height -2) 2))

  (gimp-palette-set-background background-colour)
  ;______________________________________________________________________

  (if (= (string-length filename) 0)
      (gimp-display-new image)
      (file-png-save TRUE image background filename filename
		     FALSE 9 TRUE ; interlace, compression, background col
		     FALSE FALSE FALSE FALSE)) ; gamma, off, time, phys
)
;======================================================================

(script-fu-register
  "script-fu-debian-cd-bar" ; function name
  "<Toolbox>/Xtns/Script-Fu/Debian/Debian-CD menubar" ; menu position
  "PNG generator for http://www.debian.org/CD/";
  "Richard Atterer <atterer@debian.org>" ; author
  "Copyright 2002 - released under the GPL" ; copyright message
  "Jul 13, 2002" ; date created
  "" ; Image type that the script works on
  SF-VALUE "Text" "\"net_install\"" ; a text variable
  SF-FONT  "Font" "-bigelow-luximono-medium-r-normal-*-*-640-*-*-p-*-iso10646-1"
  SF-VALUE "Font size (pt*10)" "130"
  SF-VALUE "Final height (pixels)" "32"
  SF-VALUE "Filename or \"\" to display" "\"\""
)



--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Navbar for CD now uses text and CSS instead, so there is no need to make a script for the images

Jutta
- -- http://www.witch.westfalen.de
http://witch.muensterland.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iEYEARECAAYFAkQXYxEACgkQOgZ5N97kHkcB0gCgy0JmcHj6cwlxGXWd8cObwcaO
+J0An2dZHrQdufzTflikEfTDQ/NieNJl
=3Kn4
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: