Jump to content




ChenThread Image Format - Quality images on 1.8 ComputerCraft!


18 replies to this topic

#1 asie

  • Members
  • 36 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:

Posted Image

Posted Image

Posted Image

If you just want to view CTIF-format images, a simple viewer is available here.

Edited by asie, 11 March 2016 - 10:32 PM.


#2 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, 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

#3 asie

  • Members
  • 36 posts

Posted 12 March 2016 - 12:18 PM

View PostCrazedProgrammer, on 12 March 2016 - 11:47 AM, said:

You are using the new characters at 128-159, right?

Yes. That is why it requires Minecraft 1.8+.

Quote

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)

Quote

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 by asie, 12 March 2016 - 12:23 PM.


#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (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? :/

#5 asie

  • Members
  • 36 posts

Posted 12 March 2016 - 02:48 PM

View PostBomb Bloke, on 12 March 2016 - 01:23 PM, said:

[...] 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.

#6 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 12 March 2016 - 03:44 PM

Always impressive what the CC community can produce!

#7 Elttob

  • Members
  • 22 posts
  • LocationLondon, UK

Posted 28 March 2016 - 09:01 AM

I literally just did this myself, wow.

What dithering did you use? For my image format I used Floyd-Steinberg dithering.

#8 Alekso56

  • Members
  • 62 posts

Posted 05 August 2016 - 01:37 AM

I made this converter for ease of use.

#9 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 05 August 2016 - 11:26 PM

View PostAlekso56, on 05 August 2016 - 01:37 AM, said:

I made this converter for ease of use.
Wow that's amazing!
I appreciate your work :D

#10 asie

  • Members
  • 36 posts

Posted 07 May 2017 - 07:11 PM

It appears that ComputerCraft has added palettes in the latest Git version. I'll hopefully release an updated CTIF before that version comes out.

Posted Image

#11 asie

  • Members
  • 36 posts

Posted 08 May 2017 - 06:33 PM

CTIFConverter 0.2.0 has been released! See the link in the first post (then go to Releases to download it).

Posted Image

#12 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 08 May 2017 - 07:44 PM

This is truly incredible!

#13 Lignum

  • Members
  • 558 posts

Posted 08 May 2017 - 07:48 PM

Wow that was fast. I did expect the palettes to make a difference, but not to this degree. Kudos!

#14 asie

  • Members
  • 36 posts

Posted 08 May 2017 - 07:52 PM

View PostLignum, on 08 May 2017 - 07:48 PM, said:

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:

Posted Image

Posted Image

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

Posted Image

Ouch! As you can hopefully see, it's not just the addition of palettes; the algorithm improvements helped a lot as well.

Edited by asie, 08 May 2017 - 07:55 PM.


#15 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 13 May 2017 - 02: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?

#16 asie

  • Members
  • 36 posts

Posted 13 May 2017 - 05:46 AM

View PostBomb Bloke, on 13 May 2017 - 02:04 AM, said:

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:

Posted Image

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:

Posted Image

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:

Posted Image

Edited by asie, 13 May 2017 - 05:55 AM.


#17 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 May 2017 - 12:58 AM

View Postasie, on 13 May 2017 - 05:46 AM, said:

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.

#18 asie

  • Members
  • 36 posts

Posted 14 May 2017 - 03:28 PM

View PostBomb Bloke, on 14 May 2017 - 12:58 AM, said:

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.

#19 MineRobber___T

  • Members
  • 50 posts
  • LocationStop being nosy

Posted 13 August 2017 - 11:40 PM

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users