• Please review our updated Terms and Rules here

EGA (enhanced graphics adapter)

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
417
Location
Germany
Hi,

how do I convert graphics from any kind of colour-deph and format to ega-gif with the ega-palette in the best possible quality ? (perhaps with dithering filter?)
For generating the Pics I have a PII-333/512/Dos/Win98se/Win2k
For watching I use a 286/10/EGA and cshow.

Thx
Doc
 
Paint Shop Pro 6 can do this (psp602.exe is the shareware version). Choose Windows palette when reducing to 16 colors. Error diffusion dither will probably look the best on photos.
 
Irfanview will do this and almost anything else you want to do. It's very easy to use, small and if you've never used it you really should try it out. Plus it's free for non-commercial use.
 
I think 'best possible quality' is a bit of a problem:
If you go for 640x350 mode, you can choose any 16 colours from the total palette of 64 colours (2:2:2 bit RGB).
So you'll need to convert the image in 2 steps:
1) Find the most suitable 16 colours from the total of 64.
2) Find the best mapping of the image to these 16 colours (using dithering).

I guess step 1 would be more of a colour reduction approach, after which you would sort the colours on frequency. Perhaps using median cut or something.
An interesting problem is whether you would 'merge' two colours that are close together, yet both reasonably frequent.
 
exact! First is the Resolution Problem. Finding 640x350 ART (not Photos) indicates that they are mostly EGA itself.
That means the most targets are 640x400 or 640x480. Reducing the size means convertig the 16 Color VGA Art or 256 Color VGA-Art to true Color and converting to 640x350. This indicates that the image itself is changed (streched).

After that the palette must be reduced to the EGA 6Bit palette. And the Colors must be reduced to 16 at the same time. That is the most interesting part, because the are many ways to do that. You described some. What about letting a special filter caclculating patterns in order to simulate more colors. That is a procedure that most Sierra/Lucas Adventures did for their Backgrounds.

There are only a few real EGA Images in the Inernet available. Mostly they were done/created with EGA. Converting potential Images that have itself not so much colors could be very exciting. Possible target (Amiga/Atari Images with 16/32 Colors, ore some early VGA-Art with 16 or 256 colors.

Doc
 
...one more thing :)

how do I change the palette to real EGA? all programs that were mentioned do not have the option EGA-Palette.
Reducing to 16 colors with Irfanview means 16 Colors out of the VGA-Palette with 262.000 Colors.

Palette/Colors
8Bit/256 out of 262.000
6Bit/16 out of 64

So how do I do this?

Thx
Doc

PS: In a german forum someone told me to due this with a "posterize-effect", but this does not help either because
I don't know what program and how-to.
 
No matter what tool is used, unless you are willing to do a lot of work, some images will come out of the process looking very strange.

Posterization is available in Photoshop. I suspect that Irfanview with all of its plugins should do the same. Good chance that it will happen automatically with some other converters. Posterization is just a term for the planned reduction of the number of colors with ranges of colors being replaced with the closest member of smaller result set. Smart dithering would look better on average but sometimes will result in hilariously awful results.

You don't have to reduce the pixel count. Convert to fewer colors but leave the image size the same. You will only see the top 3/4 of the image and have to scroll to see the bottom. In some cases, that will suffice.

Have you tried CShow to see if it will display images designed for higher resolution displays? I remember PC Paintbrush would do the adjustments automatically transforming the VGA images I downloaded into EGA equivalents. I know there were other tools that did the same but my EGA system got retired more than a decade ago and I don't have the tools I used to use anymore.
 
You have to take into account that 640x350 may be the same size on screen as 640x480 is on VGA.
The spacing of the scanlines is just different. So you have to resize in order to get the same aspect ratio on screen, else it will look stretched on EGA.
 
the last days I experimented with vga2ega.exe (version 3.0), this old tool has some tuning-options in it,
but the results did not convice me. if I choose "ordered palette" in Photoshop with 16 colors I get nearly
the same results.

Perhaps the easiest way is to choose a "master-pic" and some people try to make a real EGA-GIF 640x350
out of it and we compare the results?

"vga2ega" only works directly on diskette, otherwise I get a "out of memory error".
 
I got it yesterday. I used Paintshop Pro Version 5.

Converting 640x400 or 640x480 to 640x350 is a bit difficult. better option is to cut 640x350 out of 640x400/480, but that depends on the picture.
cshow displays every converted picture with the correct aspect ratio on an EGA-Screen. Therfore some lines were not displayd. If there is Text at
the left out line it does not look so nice. I will try to cut or make the Picture smaller by adding black space so the aspect ratio can be the same.

The key for converting is the EGA-Palett-File. I loaded the Picture of the EGA-Palette (PNG) and changed von indexed-color to true color.
Then I was able to extract the 64color-pal. out of the picture.

I now load a VGA-picture and after that I load the EGA-pal and now I have many options to convert the picture.
At the end I choose reducing to 16 out of the 64 and save it as a gif.

For good results it is really important, that the material has only a few colors. the best results are pictures with
16 VGA colors. So I do not have to add dithering and can choose "nearest color". If I do so, only a few details
get lost. Otherwise I had to dither in order to keep the picture-details.

I am currently looking for good VGA16-Color Material. I found out that old japanese-systems had such gfx.
(PC98?). Perhaps someone has some internetsites with 16color pc98 artworks.

Doc :)
 
I think your biggest hurdle is finding a program that can remap+dither to EGA's special-case 16-out-of-64-color palette. There weren't a lot of programs that could deal with that well, but I think CSHOW could. Once you find a program that can do that, saving it to a file is easy (either take a screenshot using DOSBOX, or take a "native" screenshot on the system using Screen Thief or PCXDMP or something).
 
Dithering makes sense if i can control what spaces are dithered, but that is not possible without full editing the picture. but that is not my goal.
therefore I choose Pictures with low VGA-Colors that are dithered before, so I need only mapping to the nearest color and make no dithering.

critical are skin-colors and details that are in greytones, but I have managed some conversation that are quite good. I will upload the new EGA
Pictures later. I also made the choice that 640x350 is the maximum, so no larger pictures. Mostly I cuted the new Picture out of the old one.
That was quite simple with PaintShopPro5. It is a really good and small program.

Doc
 
I think your biggest hurdle is finding a program that can remap+dither to EGA's special-case 16-out-of-64-color palette.

This is actually one of the projects on my way-too-long todo-list: an image processing/conversion tool capable of optimizing images for oldskool platforms with their various limitations. Such as C64 character/sprite-based modes, CGA hi-colour modes, Amiga HAM, EGA, VGA etc.
As a coder, part of the problem is always to convert 'modern' image data to the memory layout of a vintage system. But having a preprocessor that is fine-tuned to also do the colour reduction and mapping to special palettes and other trickery would make the tool even more powerful.
So at some point I would like to implement a few colour reduction and dithering algorithms, and have a flexible pipeline to convert any kind of modern truecolour image to a vintage platform as optimally as possible.
 
An admirable goal, but be prepared for some deep research -- most available information/algorithms regarding color reduction and dithering assume uniform/linear colorspaces for both the source and target (or worse, the exact same colorspace for both source and target). It gets unclear what to do when your target colorspace differs from the source and you want to dither. Without dithering, it's fairly easy to pick which 16 of the available 64 EGA colors match best -- but since dithering changes the distributed error, how to pick the colors for dithering?

Because EGA is limited to 64 total colors, the search space is pretty small -- on modern systems you could probably get away with iterating through dithering the picture against all 488526937079580 palette combinations and picking the one with the least measurable error (preferably against a visual metric like SSIM). But HAM6, with its unique artifacting, couldn't be done this way.
 
So here is the new collection so far... I am working on some other GFX-stuff "PC-98"
https://www.flickr.com/photos/94839221@N05/sets/72157652364100484

Some Images are well known, but not with the EGA-Palette. I have not tested all Pictures on the real machine, but I am sure they will be exactly the same.

So here is the goal: Pick 10 of your favorites and make an EGA-Slideshow with music and stutterfree scrolling of the pics and if you wish a scroller text...just kidding :)
 
An admirable goal, but be prepared for some deep research -- most available information/algorithms regarding color reduction and dithering assume uniform/linear colorspaces for both the source and target (or worse, the exact same colorspace for both source and target).

Don't worry, I studied computer graphics and signal processing in university :)

but since dithering changes the distributed error, how to pick the colors for dithering?

Sometimes the only way is bruteforce (like the CGA tool).
I know there are some tools for Atari 8-bit that bruteforce a ton of colours to try and get the best match for a given image.
You don't always need the 'perfect' image of course. I generally prefer algorithms that are 'good enough' by using some smart heuristics to make them perform in (near-)realtime.

But HAM6, with its unique artifacting, couldn't be done this way.

Yes, that's why I want to make a tool for this sort of thing... Certain modes have very unique characteristics, and there's no way you can properly prepare an image with PhotoShop or other modern tools.
In the case of HAM, there are basically 4 ways to pick each colour: Pick a colour from the 16-entry palette, or take the previous colour and replace the R, G, or B component.

So you have two problems here:
1) Which 16 colours do you pick for the palette?
2) For each pixel, which of the 4 possibilities is the best pick?

The interesting part with 2) is that it leads to a sort of error propagation... It may well be possible that choosing a less optimal colour for one pixel leads to less errors in subsequent pixels. So perhaps some kind of 'greedy' algorithm, trying to match a group of pixels at a time is best.

A common trick with HAM6/HAM8 is to just divide the horizontal resolution by 3, and then use 3 commands to set R, G and B separately. That means every third pixel is the correct RGB value.
Simple, but effective.
 
Last edited:
Any number of "slideshow" or "presentation" packages made for DOS will do this. GRASP is a common shareware one; although others were my favorite.

Thx, I'll check them later.

Someone on a german board reminded me of the other aspect ratio of ega to vga.
I did not have checked the pictures that have been cut out of the original image for that.
If I have to correct the aspect ratio in order to get sqares then I will have to do
some converting that will easily cost a lot of quality of the converted image.

I'll check this too.
 
Back
Top