Post your best SCRs - Image to ZX Spec 1.0.1 and beyond

edited June 2009 in Development
I've been playing around with Image to ZX Spec's encoding algorithms and I've achieved a "half colour" floyd steinberg mode, that it, the image is partly coloured in appropriate places. The first step is to convert to black and white, then the black is replaced with the most common darkest colour.

Compared to version 1.0 modes the new colour mode gives good clarity for **photos**, however after seeing images on this chap's demo (particularly the Keira Knightley one) http://www.worldofspectrum.org/forums/showthread.php?t=25242 I believe the software can do much better.

[Edit]I've just found out that these images were using special graphics modes - currently I'm only interested in 8x8 colour - I have to start somewhere :) [/Edit]

I won't set a standard photo set since it'd just be stuff my encoder would already be good with - although I am looking mainly at photos. As I'm not on my coding machine atm I'll add the SCRs I've already worked with (including some poor 1.0 results) in a short while (car wash first!)

It would also be useful if you could show your original images and technical specs and settings behind the SCR creation if you know how it was done.....

I've also been toying with writing a genetic algorithm that works on a known best set of features about images... although generic Spectrum image fitness functions might be a bit difficult to determine without some sort of training meaning I'd have to add a neural net (would a few hundred images be suitable...?) for the fitness function. This will likely slow image conversion considerably.

Thanks,

Benjamin
Post edited by brownb2 on

Comments

  • edited June 2009
    The best examples:

    hoff1.png
    hoff2.png
  • edited June 2009
    I don't understand all the technical bits and don't have any converted screens for now. But since you're perfecting your tools and willing to try new things, here's an idea. What about converting images to monochrome zx spectrum screens and have an option to auto-color them instead of trying to convert the colours from the original?
    I don't know how to explain it, but there's lots of plugins nowadays that are smart enough to process a standard PC greyscale image and turn it into a full-colour one. It's not smart enough to be exact, but it does most of the hard work.
    This is the reason why I prefer to convert images to monochrome and manually add colour. Automatic colour conversion is difficult. :)
  • edited June 2009
    zxbruno wrote: »
    I don't understand all the technical bits and don't have any converted screens for now. But since you're perfecting your tools and willing to try new things, here's an idea. What about converting images to monochrome zx spectrum screens and have an option to auto-color them instead of trying to convert the colours from the original?
    I don't know how to explain it, but there's lots of plugins nowadays that are smart enough to process a standard PC greyscale image and turn it into a full-colour one. It's not smart enough to be exact, but it does most of the hard work.
    This is the reason why I prefer to convert images to monochrome and manually add colour. Automatic colour conversion is difficult. :)

    I'm adding a monchrone switch to the black and white FS converter that is currently in 1.0 - this will be added with the configuration options for the converters (and hopefully aspect ratio resize and part image selection). Regarding the automatic colour conversion, yes its very difficult :) that's why I'm adding the whizzy AG/NN code when I've got the basic conversions/manual controls out of the way - I've just been speaking to Omega and discussed the same thing regarding automatic conversion. A NN doesn't just care about one thing (unlike rules in normal programs) , e.g. the difference in each pixel colour compared to the original, but in a number of things, which changes depending on the type of image you look at, as is dependent on how you've trained it to behave :)

    I'll be releasing 1.0.1 this evening, but it won't have any of the above in - just a few bug fixes, cleanup changes and two improved FS dithering modes (half colour FS is used in the example above - lay-persons implementation detail will be explained in the readme).
  • edited June 2009
    Good thing you're talking to Omega. Make sure you visit his site and check the amazing screenshots. :)
  • edited June 2009
    There are number of people who played with optimal way of dithering images to ZX screen. I would say that the most credited shall be LCD who started it all. Zilog made his amazing dithvide, Alone Coder... etc.

    In my opinion brownb2 is trying to go somehow beyond standard approach. I am looking forward to it.
  • edited June 2009
    As mentioned version 1.0.1 is now available

    http://silentdevelopment.blogspot.com/2009/06/image-to-zx-spec-101-released.html

    I'm not happy with the full colour FS mode (it still seems broken), however I've put this out because of the new half colour FS mode which I used for the images above. There's no point in WOS updating links yet since this is more a small cleanup, couple of new improvements release. Incidentally the Full Colour FS mode now uses a contrast pre-ramp "behind the scenes" before conversion, this will be a manual option with brightness in future releases.
  • edited June 2009
    Great work ! I tested v1 previously and was impressed with the results, and your utility is comming on leaps and bounds so please keep up the good work, and keep us posted on any further improvements! :-)
  • edited June 2009
    BMP2SCR is better anyway. Floid-Steinberg is awful for color photoes.
  • edited June 2009
    BMP2SCR is better anyway. Floid-Steinberg is awful for color photoes.

    Thanks for the feedback (and/or trolling), although criticism as to why it is better is more useful than off the cuff unqualified "is better" comments.

    Perhaps a like for like image comparison would be useful (as well as what you'd expect to be improved in the comparison)? I'm aware BMP2SCR/RetroX has far more features (and is much older), but then Img2ZXSpec isn't competing in the jack of all image converter trades (which is not a criticism of that software). What it is intended to do is convert images to standard Speccy format as quickly and simply as possible - not to be an editor, and whilst this may not yet be the best tool for the job to my mind it is probably (currently and I guess arguably) the simplest to use, most platform compatible and open sourced (warts and all in the 1.x.x releases).

    Any competition is a bit of fun tbh helps spur innovation, but if I was really bothered about competing I wouldn't have bothered making it open source - especially with some of the more highbrow stuff I intend to add :)
    I'm certainly not into the scene (I only hang around on here) or competing with sceners, who clearly have better low level hacking skills, purely for two reasons - I can't be bothered (learning low level) and I can't be bothered. I do however bring a skillset from working on a variety of jobs and some more advanced concepts I've been exposed to but never tried in practice, which is what I intend to use here as it gives me useful experience, point in question is already implementing FS by hand without an API (which as it stands is actually quite trivial). While you state that FS is awful for photos many people would disagree, notably the people who wrote it to get around cross hatch caused by ordered dither, and it is considered it to be the best of the original classical algorithms (i.e. not including FS improvements such as Stucki, Burke etc etc). Having said that, I'll be adding ordered dither and/or Atkinson (less noisy FS derivative) in the near future.

    I hope this helps shine some light onto the thought process behind Img2ZXSpec. :)
  • edited June 2009
    If you do not need comments - then go make thatthing for youself. Ok, no problem. For me this thing is useless.
  • edited June 2009
    Someone's having a bad day? Re-read his post and you'll see who's sounding harsh. He, like any other developer, appreciates constructive feedback. Your comment sounded more like destructive criticism than anything. I'm sure LCD, Dunny, Marko and even Philip Kendall would agree with me. Useless, uh? It's because of comments like these that I've seen good people misinterpret things and disappear from the world of spectrum.

    I'm not judging or moderating. I worry about the Sinclair scene, and some of us do want to see the development of this tool.

    You spoke your mind. Don't attack me for speaking mine.
  • edited June 2009
    brownb2 wrote: »
    While you state that FS is awful for photos many people would disagree, notably the people who wrote it to get around cross hatch caused by ordered dither, and it is considered it to be the best of the original classical algorithms

    My feeling is that FS is awful for photos when the additional constraint of 8x8 attribute colour clash is imposed. Greyish areas are particularly tricky, as they tend to come out particularly noisily. Your plan of favouring monochrome, and using colour more sparingly is a good one. Mac2Spec favours black and white when there is no clear 'winner' for a particular attribute block. FS is much better when: the attribute clash is lesser, as it is for Timex 8x1 attributes; or the palette is restricted, as it is for monochrome. The nature of ordered dithers makes it a good fit for the Spectrum's attribute system. An 8x8 ordered dither fits perfectly with the attributes, and tends to give pretty good results for a straightforward algorithm.
  • edited June 2009
    zxbruno wrote: »
    Someone's having a bad day? Re-read his post and you'll see who's sounding harsh. He, like any other developer, appreciates constructive feedback. Your comment sounded more like destructive criticism than anything. I'm sure LCD, Dunny, Marko and even Philip Kendall would agree with me. Useless, uh? It's because of comments like these that I've seen good people misinterpret things and disappear from the world of spectrum.

    I'm not judging or moderating. I worry about the Sinclair scene, and some of us do want to see the development of this tool.

    You spoke your mind. Don't attack me for speaking mine.

    He/she is trolling and based on their website doesn't appear to have accomplished much themselves (perhaps I'm wrong but I don't really care). People in glass houses shouldn't throw stones. Thanks for the criticism and feedback I've received btw from all involved - it really helps me develop this into something that is useful for some of us :) Features such as aspect ratio, improved UI, suggestions for converters etc are things I've taken on board and will implement in the short term (I'd like to get some decent dither modes done first tho').
    JamesW wrote:
    My feeling is that FS is awful for photos when the additional constraint of 8x8 attribute colour clash is imposed. Greyish areas are particularly tricky, as they tend to come out particularly noisily. Your plan of favouring monochrome, and using colour more sparingly is a good one. Mac2Spec favours black and white when there is no clear 'winner' for a particular attribute block. FS is much better when: the attribute clash is lesser, as it is for Timex 8x1 attributes; or the palette is restricted, as it is for monochrome. The nature of ordered dithers makes it a good fit for the Spectrum's attribute system. An 8x8 ordered dither fits perfectly with the attributes, and tends to give pretty good results for a straightforward algorithm.

    I agree with the clash issue - the Full FS mode is frankly messed up because FS diffusion can't use the error colours it wants - the second pass picks up error colours as the original colours and it looks garish. I'll add Atkinson probably this evening with the colour model from the default converter (i.e. direct colour map) which hopefully should look miles better - I'll post samples on here as soon as it's done.

    TBH the dither modes are still up in the air as to which to keep, as FS seems to be unpopular I'll probably end up just adding a few FS derivatives instead with ordered and the original direct mapping. I've already dropped Averaging colour mode from 1.0 original because frankly it was poorest.
  • edited June 2009
    Don't expect too much from various dithering modes. Floyd-Steinberg is nearly the best choice. I don't know how is your FS implementation done, looking at the pictures you have left to right dither. You might improve by serpentine scanning of each line (left-right, right-left). This reduces runout of pixels and some repetitive artefacts on the image.

    If anyone is interested, this is very good resource of some dithering methods: http://caca.zoy.org/study/part3.html

    The best constants for floyd kernel are:
    normal (left to right): 6 5 3 2
    serpentine (lr, rl): 7 4 5 0

    Whole science is described in this whitepaper: http://caca.zoy.org/raw-attachment/wiki/publications/2008-displacement.pdf
  • edited June 2009
    omega wrote: »
    Don't expect too much from various dithering modes. Floyd-Steinberg is nearly the best choice. I don't know how is your FS implementation done, looking at the pictures you have left to right dither. You might improve by serpentine scanning of each line (left-right, right-left). This reduces runout of pixels and some repetitive artefacts on the image.

    If anyone is interested, this is very good resource of some dithering methods: http://caca.zoy.org/study/part3.html.....

    Very good article - the block diffusion looks interesting, but I wonder if it will work at 8x8 - has anyone else tried it? It might get around the problem of the error colour being the same as the original colour (as would be the case with pixels in the same attribute block). The FS dither I've used just works left to right - I hadn't come across using different scanning since I just based the implementation on the wikipedia FS description!
  • edited June 2009
    If you do not need comments - then go make thatthing for youself. Ok, no problem. For me this thing is useless.
    Ignore him, he's a twat...
    I wanna tell you a story 'bout a woman I know...
  • edited June 2009
    I really like that prog, I may have no use for it but find it fascinating to Spectrumize pictures.

    To those (and you know who you are) who call this program useless remember 99% of Spectrum software are games and games are useless, they don't actually do, achieve or resolve anything they're just fun to play.

    Isn't that the whole idea?
    I wanna tell you a story 'bout a woman I know...
  • edited June 2009
    If you do not need comments - then go make thatthing for youself. Ok, no problem. For me this thing is useless.

    What a Lamer, what have you added to the community? I'd like to see you have an attempt at writing an ace util like this
  • edited June 2009
    What a Lamer, what have you added to the community? I'd like to see you have an attempt at writing an ace util like this
    tbh his sig tells you everything you need to know.

    I prefer twat to lamer... :lol:
    I wanna tell you a story 'bout a woman I know...
  • edited June 2009
    as I followed brownb2's messages, I started to think that he is not after writing an ace util, yet he wants to find the best conversion technique using standard-clashy screen.
    the util came as a bonus, that's all. And I'm following this conversion threads very closely, I already learned much.

    back to topic, when I try to convert pictures to speccy, I generally pre-process the pictures in photoshop. I use sharpen and edge detect (and some top-secret mixture of filters) to increase corner visibility thus maintaining contrasty areas in the resulting picture. But brownb's approach is something different, he divides the source image into parts, and convert them seperately. Maybe pre-process each part before converting using different settings/effects may generate nice result too.
  • edited June 2009
    Arda wrote: »
    as I followed brownb2's messages, I started to think that he is not after writing an ace util, yet he wants to find the best conversion technique using standard-clashy screen.
    the util came as a bonus, that's all. And I'm following this conversion threads very closely, I already learned much.

    Good call - almost spot on. The tool is mostly to help me learn some new skills, the utility is my way of doing that and is the intention from the start with all the software I write and have on my site. From discussing working on this I've learnt about a number of different things:

    - Byte manipulation in Java (although I'm still poor at it).
    - Spectrum SCR and TAP formats
    - Dithering techniques (including stuff Omega has mentioned).
    - JGAP/Genetic Algorithms (which I've dismissed).
    - Neural Nets (might still use).
    - Weka API (I'm going to be looking at today).
    - Spectrum graphics modes.
    - Java Webstart.
    - The WOS community is very supportive :)
    - The Speccy still can be an educational tool!

    The utility should be good at its specific things - batch conversion, good choice of conversion algorithms and hopefully intelligent best mode selection.
  • edited June 2009
    Atkinson is absolutely fantastic for the job - I've used the same error distribution matrix but weighted it slightly differently and used a 1.7x contrast pre ramp and can get consistently good images with significantly reduced dither artifacts.... plus I've refactored a lot of the dither and colour code so I can easily swap different dither matrices and colour selection algorithms and have a more clearly defined two stage process.

    robo.png
    roboclassic.png
    robopose.png
    knight.png
  • edited June 2009
    IMHO, if you apply contrast/gamma your original Floyd-Steinberg would look significantly better. I don't like Atkinson dither kernel, image is too rough. Just my subjective opinion.
  • edited June 2009
    omega wrote: »
    IMHO, if you apply contrast/gamma your original Floyd-Steinberg would look significantly better. I don't like Atkinson dither kernel, image is too rough. Just my subjective opinion.

    Have you got another example image I can use that you can convert with RetroX/BMP2SCR that looks better so I can get a feeling of what you mean? BTW don't use the bottom KR image on this page as I saved it using the snip tool and it dithered it saving to PNG (how stupid is that?) grrrrrrrrrr :)

    I tried a pre-constrast increase on the FS unfortunately it wasn't very effective since it just seemed to show up artifacts more (the error diffusion is 100% meaning colours were very off when mapped to Spectrum's palette). The modified Atkinson distribution I used below doesn't use 6x(1/8) (75% error distribution) but 6x(1/12) so it only has 50% error allowing the colours to just be exaggerated with contrast but close to their originals due to little error. The original Atkinson had the same problems as the FS in midtones specifically, but less colour error means less likelihood of wrong colour chosen and increase in contrast means similar areas (e.g. skin) share the same Spectrum colour. Having said this I haven't got a gamma control (just contrast) so I'll add one tonight and see if there's any difference on this and FS - I'll post on my blog rather than flooding here with more images!

    I'm happy with this mode so far but images such as the knight rider still look over exposed - manual contrast controls and the ability to change dither should fix this....
Sign In or Register to comment.