pixinn / rgb2amiga Goto Github PK
View Code? Open in Web Editor NEWConverts RGB images (png, jpeg, etc.) to IFF/ILBM files tailored for Amiga OCS/ECS (Amiga 1000, 2000, 3000, 500, 500+, 600).
License: Other
Converts RGB images (png, jpeg, etc.) to IFF/ILBM files tailored for Amiga OCS/ECS (Amiga 1000, 2000, 3000, 500, 500+, 600).
License: Other
Right now this is using ImageMagick's quantization to reduce the number of colors in the image, after mapping the entire image to Amiga's 4096 color colorspace. But quantization can (and does) introduce mix colors again that are not part of the Amiga colorspace. So the resulting CPalette
in the CChunkImage
is actually not guaranteed to include only colors available on the Amiga. This is "sort of" fixed later when those colors again get converted in libamivideo, but it produces results that are less optimal than what ImageMagick could achieve.
IMO, the "correct" way to do this is to
Magick::Image
as a colormap and fill it with the unique colorsmap
function with the colormap as inputSomething like this (in CChunkyImage::Init
)
_imageRGB = img;
// Constrain the colors to the provided Palette. We cannot only use the
// default quantization, because that will introduce colorshifts to better
// represent neighbouring pixel regions, it does not respect the colors
// already in the image.
_imageRGB.quantizeColors(nbColors);
_imageRGB.quantizeDither(dither);
_imageRGB.quantizeDitherMethod(Magick::FloydSteinbergDitherMethod);
//_imageRGB.orderedDither("o3x3,2");
_imageRGB.quantize();
// now map the color reduced image using a map that only contains valid Amiga colors
CPalette quantizedPalette = CPaletteFactory::GetInstance().GetUniqueColors(_imageRGB);
Image map(Geometry(quantizedPalette.size(), 1), "white");
MagickCore::PixelPacket* pixel = map.getPixels(0, 0, map.size().width(), map.size().height());
for (std::size_t i = 0u; i < quantizedPalette.size(); ++i)
{
const auto nearestAmigaColor = paletteSpace.GetNearestColor(quantizedPalette[i]);
pixel->red = nearestAmigaColor.r << (8 * (sizeof(pixel->red) - 1));
pixel->green = nearestAmigaColor.g << (8 * (sizeof(pixel->green) - 1));
pixel->blue = nearestAmigaColor.b << (8 * (sizeof(pixel->blue) - 1));
++pixel;
}
map.syncPixels();
// map again from the original, which can potentially match slightly better
_imageRGB = img;
_imageRGB.map(map, dither);
_palette = CPaletteFactory::GetInstance().GetUniqueColors(_imageRGB);
I can open a PR, but I have other changes in my fork now that I'll need to factor out
Hi,
The build you have in releases does not start. There are missing DLLs:
CORE_RL_bzlib_.dll
CORE_RL_lcms_.dll
CORE_RL_lqr_.dll
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.