Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyfair/fi-luajit
FreeImage Luajit2 binding
https://github.com/nyfair/fi-luajit
Last synced: 7 days ago
JSON representation
FreeImage Luajit2 binding
- Host: GitHub
- URL: https://github.com/nyfair/fi-luajit
- Owner: nyfair
- License: unlicense
- Created: 2015-06-06T09:18:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-03T04:32:43.000Z (over 8 years ago)
- Last Synced: 2024-02-14T05:34:56.472Z (9 months ago)
- Language: Lua
- Size: 9.77 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-resty - fi-luajit
README
fi-luajit
========A LuaJIT interface to FreeImage
*Note*: this FreeImage interface supports handling unicode filenames on Windows.
In order to use this feature, make sure your lua script files are UTF-8 encoded.# Usage #
```lua
require 'fi'---
# convert image format
convert('*.webp', 'tiff')
# convert image format and bpp
convbpp('*.png', 32, 'bmp')
# convert image format with quality setting
convert('1.png', '1.jpg', 90)# alpha composite with 24bpp background 8bpp foreground
back = open('rgb24.bmp')
front = open('alpha8.bmp')
back_resized = scale(back, getw(front), geth(front))
back_rgba = to32(back_resized)
save(back_resized, 'resized.png', 9)
save(back_rgba, 'back.tiff')
out = composite(back_rgba, front)
save(out, 'composite.png')
freeAll({back_resized, front, out, back_rgba})
free(back)
...
```CLI interface
```bash
# windows cmd with TrueType font
copy test\conv.lua to the same directory of luajit.exe
chcp 65001
# unix-like system
alias conv="noglob luajit test/conv.lua"# convert image format
conv *.png jpg
conv 民逗Σ.dds 二マビ.webp
# convert image format and bpp
conv abc.jpg 32 abc.tiff
# convert image format with quality setting
conv 汉字.bmp 漢字.jpg 75
```