Converting image to a defined pallet of colors

  • Hallo UEZ,

    im englischem Forum habe ich das von dir gesehen: https://www.autoitscript.com/forum/topic/18…llet-of-colors/

    Bei mehr als 16 $iColors wird das Bild nicht mehr verfremdet.

    Hier dein Script, mit mehr als 16 icolors.

    Was muss man einstellen um > 16 icolors zu nutzen.

    Habe schon die 256 geändert, bringt aber auch nichts.

  • Du musst die Zeile 43 anpassen:

    Code
    _GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF08INDEXED, $GDIP_DitherTypeDualSpiral8x8, $GDIP_PaletteTypeFixedHalftone256, $tPalette)

    Wenn $GDIP_PXF04INDEXED gewählt ist, dann sind nur 2^4 = 16 Farben vorgesehen.

    Beispiel:

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    2 Mal editiert, zuletzt von UEZ (13. März 2019 um 21:09)

  • ah, super,

    wo sind denn mal die _GDIPlus_BitmapConvertFormat z.b. $GDIP_PXF08INDEXED, $GDIP_DitherTypeDualSpiral8x8 ... usw. genau beschrieben.

    In der Hilfe habe ich auf den ersten Blick nichts gefunden?

  • Hallo UEZ,

    ich muss noch einmal nachfragen.

    Bei den unteren Einstellung macht GDI+ mir diese Bild

    aber so soll es ausehen

    und das ist das original


    Was muss ich hier anders machen

    Local $tPalette = _GDIPlus_PaletteInitialize($iColors, $GDIP_PaletteTypeOptimal, $iColors, False, $hImage)

    _GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF08INDEXED, $GDIP_DitherTypeSolid, $GDIP_PaletteTypeOptimal, $tPalette)

    $tPalette.ARGB((1)) = 0xFF0E18F8

    $tPalette.ARGB((2)) = 0xFF1C2FE6

    $tPalette.ARGB((3)) = 0xFF2945D3

    $tPalette.ARGB((4)) = 0xFF365CC1

    $tPalette.ARGB((5)) = 0xFF4372AE

    $tPalette.ARGB((6)) = 0xFF50889B

    $tPalette.ARGB((7)) = 0xFF5E9F89

    $tPalette.ARGB((8)) = 0xFF6BB576

    $tPalette.ARGB((9)) = 0xFF78CC64

    $tPalette.ARGB((10)) = 0xFF85E251

    $tPalette.ARGB((11)) = 0xFF92F83E

    $tPalette.ARGB((12)) = 0xFF92F83E

    $tPalette.ARGB((13)) = 0xFF9AE63D

    $tPalette.ARGB((14)) = 0xFFA1D33C

    $tPalette.ARGB((15)) = 0xFFA8C13B

    $tPalette.ARGB((16)) = 0xFFAFAE39

    $tPalette.ARGB((17)) = 0xFFB69B38

    $tPalette.ARGB((18)) = 0xFFBE8937

    $tPalette.ARGB((19)) = 0xFFC57635

    $tPalette.ARGB((20)) = 0xFFCC6434

    $tPalette.ARGB((21)) = 0xFFD35133

    $tPalette.ARGB((22)) = 0xFFDA3E31

    $tPalette.ARGB((23)) = 0xFFDA3E31

    $tPalette.ARGB((24)) = 0xFFDE5133

    $tPalette.ARGB((25)) = 0xFFE16435

    $tPalette.ARGB((26)) = 0xFFE57737

    $tPalette.ARGB((27)) = 0xFFE88A38

    $tPalette.ARGB((28)) = 0xFFEB9C3A

    $tPalette.ARGB((29)) = 0xFFEFAF3C

    $tPalette.ARGB((30)) = 0xFFF2C23D

    $tPalette.ARGB((31)) = 0xFFF6D53F

    $tPalette.ARGB((32)) = 0xFFF9E841

    $tPalette.ARGB((33)) = 0xFFFCFA42

  • Die GDI+ Funktion macht genau das, was du ihm sagt, nämlich eine Reduzierung der Farbwerte gemäß deiner Farbtabelle.

    Du müsstest eher die Farben manipulieren. Wie genau, weiß ich nicht und ich kann dir nicht sagen, ob dies direkt über GDI+ möglich ist.

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Hallo UEZ,

    doch noch ne Frage.

    Warum kann ich nicht mehr als 256 Farben nutzen.

    Bei > $tPalette.ARGB((256)) bricht es ab.

    Habe jetzt diese Einstellung:

    Code
    Local $iPaletteType = $GDIP_PaletteTypeOptimal
    Local $tPalette = _GDIPlus_PaletteInitialize($iColors, $iPaletteType, $iColors, False, $hImage)
    _GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF08INDEXED, $GDIP_DitherTypeSolid, $iPaletteType, $tPalette)