Deutsches CPC-Forum > Programmierung

PNG to CPC

(1/1)

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 21 --- 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)
--- End quote ---




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();
}

Navigation

[0] Message Index

Go to full version
Powered by SMFPacks Reactions Mod
Powered by SMFPacks Alerts Pro Mod
Powered by SMFPacks Mentions Pro Mod