Posted 24 May 2018 - 04: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…
Not only does this API allow basic things such as loading and drawing images, but it also allows for various transformations as well!
API: (either use os.loadAPI or dofile/require)
Demo:
Examples of use:
Demo video:
[media]http://www.youtube.com/watch?v=MBrqlhVwRu8[/media]
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!
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
image = nfte.loadImage(string filepath)
image = nfte.loadImageData(string contentsOfImageNFT)
contentsOfImageNFT = nfte.unloadImage(table image)
image = nfte.convertFromNFP(table loadedImageNFP)
nfte.drawImage(table image, number x, number y)
nfte.drawImageTransparent(table image, number x, number y)
nfte.drawImageCenter(table image, number x, number y)
nfte drawImageCenterTransparent(table image, number x, number y)
imageXsize, imageYsize = nfte.getSize(table image)
lightImage = nfte.lighten(table image, number repeatTimes)
darkImage = nfte.darken(table image, number repeatTimes)
stretchedImage = nfte.stretchImage(table image, number sizeX, number sizeY, boolean doRepeatCharacters)
pixelatedImage = nfte.pixelateImage(table image, number intensity)
mergedImage = nfte.merge({table image1, number x, number y}, {table image2, number x, number y}, ...)
croppedImage = nfte.cropImage(table image, number x1, number y1, number x2, number y2)
reversedImage = nfte.flipX(table image)
upsideDownImage = nfte.flipY(table image)
animatedImage = {
image1,
image2,
image3
}
ANFTfileContents = nfte.unloadImage(animatedImage)
ANFTimageData = nfte.loadImageData(ANFTfileContents)
Demo video:
[media]http://www.youtube.com/watch?v=MBrqlhVwRu8[/media]
Edited on 22 December 2018 - 07:39 AM