PNG to CPC

Started by zhulien, 03:29, 04 October 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zhulien

Hi,


has anyone written logic for PNG loading on a CPC,


or better still... in PHP taking a PNG file and converting it to CPC (Mode 1 is preferable, but possibly mode 0).


Something like this but in PHP, not GO


https://github.com/jeromelesaux/martine 

Julian
(sorry this should be in the English section)

luckpro

Quote from: zhulien on 03:29, 04 October 21Hi, has anyone written logic for PNG loading on a CPC, or better still... in PHP taking a PNG file and converting it to CPC (Mode 1 is preferable, but possibly mode 0). Something like this but in PHP, not GO https://github.com/jeromelesaux/martine Julian (sorry this should be in the English section)




Hi zhulien,
I have never done it, but I think it would not be very complex if you use a library like ImageMagick.
https://www.php.net/manual/es/book.imagick.php
$im = new Imagick("foo.png");
$it = $im->getPixelIterator();
foreach($it as $row => $pixels)
{
foreach($pixels as $column => $pixel) {
// Do something with $pixel, transform to mode 0/1 and prepare to CPC format
}
$it->syncIterator();
}

Powered by SMFPacks Menu Editor Mod