Author Topic: PNG to CPC  (Read 431 times)

0 Members and 1 Guest are viewing this topic.

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 917
  • Country: au
  • aka Vorax
    • 8bitology
    • Awards
PNG to CPC
« 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)
« Last Edit: 03:34, 04 October 21 by zhulien »
like
0
No reactions

Offline luckpro

  • CPC464
  • **
  • Posts: 37
  • Country: es
    • Awards
Re: PNG to CPC
« Reply #1 on: 10:03, 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)




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();
}
like
0
No reactions