38 posts
Posted 11 March 2016 - 10:30 PM
While researching image rendering on the screens of a different Minecraft mod, it occured to me that the methods I have found could be adapted to ComputerCraft's new teletext blocks, albeit with some quality loss - and thus I gave it a try.
Everything you need to know will likely be on
https://github.com/ChenThread/ctif . Note it's not very user-friendly (yet - I have one viewer yet to be finished before I can work on improvements in this department) and it has not been tested on Windows.
Here's some example conversions:



If you just want to view CTIF-format images, a simple viewer is available
here.
Edited on 11 March 2016 - 09:32 PM
546 posts
Location
Wageningen, The Netherlands
Posted 12 March 2016 - 11:47 AM
Wow, that is really impressive!
You are using the new characters at 128-159, right?
Am I allowed to use the image format in my own API (saving and/or loading)?
Anyway, glad to see someone use the new CC characters to its fullest potential.
Maybe you could do animations/videos/realtime demo stuff next :D/>
38 posts
Posted 12 March 2016 - 12:18 PM
You are using the new characters at 128-159, right?
Yes. That is why it requires Minecraft 1.8+.
Am I allowed to use the image format in my own API (saving and/or loading)?
The converter and viewers are licensed under MIT - if you want to use code from them, read the license. The API is not copyrighted in any specific way, I'm no Oracle. Attribution/credit would be appreciated, however.
Why would you even ask if you're allowed to use
a file format? (Assuming it's not patented, but then that doesn't happen too often)
Anyway, glad to see someone use the new CC characters to its fullest potential.
Maybe you could do animations/videos/realtime demo stuff next :D/>
Sadly, I'm not really a ComputerCraft person. This is merely the result of me getting bored and curious.
Edited on 12 March 2016 - 11:23 AM
7083 posts
Location
Tasmania (AU)
Posted 12 March 2016 - 01:23 PM
Not too shabby. :)/>
I've got
one of my own, though it doesn't dither as intelligently as what I'm seeing in your screenshots. Is that what you're using ImageMagick for? I would've thought everything could be handled with standard Java libraries?
Anyway, I've gotta ask… why no Chen pic? :/
38 posts
Posted 12 March 2016 - 02:48 PM
[…] Is that what you're using ImageMagick for?
Anyway, I've gotta ask… why no Chen pic? :/
1. Not really - Floyd-Steinberg and co. are fairly easy to implement, and I do plan to replace them with a Java-based implementation one day to allow for more variety in dithering algorithms. That and high-quality Lanczos scaling is the primary reasons for which I depend on ImageMagick, but there's other tricks involved.
2. I spent a good half an hour looking for a good Chen pic.
2679 posts
Location
You will never find me, muhahahahahaha
Posted 12 March 2016 - 03:44 PM
Always impressive what the CC community can produce!
22 posts
Location
London, UK
Posted 28 March 2016 - 10:01 AM
I literally just did this myself, wow.
What dithering did you use? For my image format I used Floyd-Steinberg dithering.
66 posts
Posted 05 August 2016 - 02:37 AM
I made
this converter for ease of use.
546 posts
Location
Wageningen, The Netherlands
Posted 06 August 2016 - 12:26 AM
I made
this converter for ease of use.
Wow that's amazing!
I appreciate your work :D/>
38 posts
Posted 07 May 2017 - 08:11 PM
38 posts
Posted 08 May 2017 - 07:33 PM
CTIFConverter 0.2.0 has been released! See the link in the first post (then go to Releases to download it).

546 posts
Location
Wageningen, The Netherlands
Posted 08 May 2017 - 08:44 PM
This is truly incredible!
570 posts
Posted 08 May 2017 - 08:48 PM
Wow that was fast. I did expect the palettes to make a difference, but not to this degree. Kudos!
38 posts
Posted 08 May 2017 - 08:52 PM
Wow that was fast. I did expect the palettes to make a difference, but not to this degree. Kudos!
Actually, the CTIF rewrite made a fair amount of improvements as well!
Here's a comparison of the same image (almost) converted with CTIF 0.2.0 for non-paletted and paletted ComputerCraft:


And here's the same picture converted with CTIF 0.1.1 for non-paletted CC:

Ouch! As you can hopefully see, it's not just the addition of palettes; the algorithm improvements helped a lot as well.
Edited on 08 May 2017 - 06:55 PM
7083 posts
Location
Tasmania (AU)
Posted 13 May 2017 - 03:04 AM
Did you maybe get the images mixed up? 0.2.0's non-paletted output is apparently showing lots more out-of-place blue / green pixels than 0.1.1's did?
38 posts
Posted 13 May 2017 - 06:46 AM
Did you maybe get the images mixed up? 0.2.0's non-paletted output is apparently showing lots more out-of-place blue / green pixels than 0.1.1's did?
They are not out of place, they're the best approximation of the given color. That's how error diffusion works - notice that the original color, more visible in the paletted output, is a little bit bluish. Applying heavy blur shows the same thing,
like so. You can use –dither-level 0.7 or so to decrease that effect, however, like so:

You can also use the newly introduced ordered dither, because - due to a different algorithm - they do not propagate error in the same way error diffusion does, and as such avoid this side-effect. They also use a pattern for dithering, but at this time it is unfortunately not implemented as well as error diffusion, like so:

However, when the palette is closer to the original image, the ordered dithering algorithm shows results which are not far off in terms of quality from error diffusion, like so:

Edited on 13 May 2017 - 04:55 AM
7083 posts
Location
Tasmania (AU)
Posted 14 May 2017 - 01:58 AM
notice that the original color, more visible in the paletted output, is a little bit bluish.
Sorry, I should've been more specific: top left corner of the re-paletted image veers towards
red. Unpaletted 0.1.0 heads towards grey. Unpaletted 0.2.0 suddenly crams the area with bright blue / green pixels.
38 posts
Posted 14 May 2017 - 04:28 PM
top left corner of the re-paletted image veers towards red.
#22282b is very slightly bluish. I am aware of what you're trying to point out, but I think I explained fully as to why it happens and how to mitigate it if such an effect is undesired.
53 posts
Location
Stop being nosy
Posted 14 August 2017 - 12:40 AM
The ComputerCraft viewer is failing for me. It says:
"ctif.lua:38:bad argument #1 (number expected, got table)"
I'm using the latest build.