nsimage(n)
π nsimage(n) β the macOS NSImage Tk image type π
Hey bestie π«Ά welcome to the nsimage(n) page from Tk Built-In Commands. This is the whole vibe: a Tk image type that's all about macOS and the NSImage class. Let's go π
πΈ NAME πΈ
nsimage β a Tk image type for macOS based on the NSImage class. Periodt. π
β¨ DESCRIPTION β¨
Okay so nsimage is implemented as a Tk image type. The image command is used to create, delete, and query all images, including images of type nsimage. The options that are available are specific to the nsimage type, and they're all described below. No cap. π
The command to create an nsimage is:
image create nsimage ?name? ?option value ...?
This creates a new nsimage and a command with the same name, and returns its name. Slay. π
π OPTIONS π
Valid options are:
-source stringβ The value is a string describing anNSimage. There are several ways to interpret this string, and the interpretation is determined by the value of the-asoption. This option is required β don't skip it, bestie. π¨-as typeβ There are four possible values for this option, and they specify how the source string should be interpreted. The allowed values and their meanings are:nameβ The source should be interpreted as the name of a namedNSImageprovided by the system. This is the default if the-asoption is not specified. πfileβ The source should be interpreted as a path to an image file in one of the formats understood by theNSImageclass. πΌοΈpathβ The source should be interpreted as a path to an arbitrary file. The type of the file will be examined, and the resulting image will be the system icon for files of that type. πfiletypeβ The source is interpreted as a string identifying a particular file type. It may be a filename extension, an Apple Uniform Type Identifier, or a 4-characterOSTypevalue as used in the HFS filesystem. π
-width pixelsβ The value is an integer specifying the width in pixels of thensimage. If the width is not specified, it will be computed from the height so as to preserve the aspect ratio. If neither width nor height is specified, then the width and height of the underlyingNSImagewill be used. π-height pixelsβ The value is an integer specifying the height in pixels of thensimage. If the height is not specified, it will be computed from the height so as to preserve the aspect ratio. If neither width nor height is specified, then the width and height of the underlyingNSImagewill be used. π-radius pixelsβ The value is an integer. If non-zero, the image will be clipped to a rounded rectangle with the same width and height as the image, but with circular arcs of the specified radius cutting off the corners of the rectangle. π-ring pixelsβ The value is an integer. If non-zero, it specifies the thickness of a focus ring that will be drawn around the image using the control accent color specified in the System Preferences. The image is resized to reduce its width and height by twice the thickness of the ring. Note that this may create a small amount of distortion. The aspect ratio of a non-square image will change slightly. β-alpha floatβ The value should be a floating point number between0.0and1.0. This alpha value will be applied to each pixel of thensimage, producing a partially transparent image. The default value is1.0, which makes the image opaque. β¨-pressed booleanβ This takes a boolean value. If the value is true or1, then the image will be algorithmically modified to become darker in light mode or lighter in dark mode. The default is false. For an image button, the primary image should use the value false while the pressed image should be the same image but with the-pressedoption set to true. π-template booleanβ This takes a boolean value. If the value is true or1, then the image will be marked as being a template image. This means that the system will algorithmically convert the image to a light colored image when in dark mode. For the algorithm to work correctly, the image must consist only of black pixels with alpha values. π€
π¦ SEE ALSO π¦
Go check out image(n), options(n), and photo(n). Iykyk. π
π KEYWORDS π
height, image, types of images, width β that's the keyword vibe, bestie. π
Okay bye bestie π β source/version: Tk 9.0, page: nsimage(n). The footer had no date, so I'm not inventing one, periodt. π«Ά
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 2022 Marc Culler
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms