nsimage(n)

πŸ“¦
version 9.0.3 Β· 2 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– 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 an NSimage. There are several ways to interpret this string, and the interpretation is determined by the value of the -as option. 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 named NSImage provided by the system. This is the default if the -as option is not specified. πŸ’…
    • file β€” The source should be interpreted as a path to an image file in one of the formats understood by the NSImage class. πŸ–ΌοΈ
    • 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-character OSType value as used in the HFS filesystem. 🍎
  • -width pixels β€” The value is an integer specifying the width in pixels of the nsimage. 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 underlying NSImage will be used. πŸ“
  • -height pixels β€” The value is an integer specifying the height in pixels of the nsimage. 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 underlying NSImage will 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 between 0.0 and 1.0. This alpha value will be applied to each pixel of the nsimage, producing a partially transparent image. The default value is 1.0, which makes the image opaque. ✨
  • -pressed boolean β€” This takes a boolean value. If the value is true or 1, 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 -pressed option set to true. πŸŒ—
  • -template boolean β€” This takes a boolean value. If the value is true or 1, 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