Jump to content




NFT Extra: the essential API for your NFT needs!


1 reply to this topic

#1 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 24 May 2018 - 03:49 PM

I had made an "extra" version of NFP earlier, so I thought I'd try to rewrite it for NFT as well.
So, I give you...

NFT Extra


Not only does this API allow basic things such as loading and drawing images, but it also allows for various transformations as well!
  • Stretching images to arbitrary sizes!
  • Saving multiple NFT images as one layered image (Animated NFT)
  • Merging two or more images at differing positions!
  • Flipping images!
  • Converting from NFP!
  • Darkening and lightening images!
  • Converting to grayscale!
  • Cropping!
  • Rotating!
It's the best way to use the NFT image format, probably! Feel free to put it in your programs.

API: (either use os.loadAPI or dofile/require)
wget https://github.com/LDDestroier/NFT-Extra/raw/master/nfte.lua nfte

Demo:
wget https://raw.githubusercontent.com/LDDestroier/NFT-Extra/master/demo.lua demo

Examples of use:
Spoiler

Demo video:

Edited by LDDestroier, 22 December 2018 - 08:39 AM.


#2 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 20 December 2018 - 07:05 AM

The rotation function has been fixed up, so there aren't any black dots in the middle of an image.
nfte.flipX now flips most teletext characters so images that use them won't look weird.
If you use nfte.unloadImage on a table containing other NFT table images, it will turn it into a multilayered NFT image, which can be read normally with nfte.loadImage or nfte.loadImageData. Expect this as the new PAIN file format.

There's also a new demo available to show NFTE's functions, so try that out if you want to see just what is possible.

nfte.stretchImageKeepAspect() has also been added. It's the same as stretchImage, but maintains the image's aspect ratio for you.

nfte.merge() can also accept 'true' as a coordinate in its arguments, which will center the image in the corresponding coordinate.

Edited by LDDestroier, 28 February 2019 - 06:25 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users