Git Product home page Git Product logo

Comments (5)

shackiey avatar shackiey commented on September 13, 2024 1

Hi - I just encountered this issue myself, and was very pleased to see this mapping fix implemented. However, I dug a little deeper into Gimp to find why this was happening with images I prepared. Turns out when the inkyphat palette is imported into Gimp, it is re-ordering the colours so that they are not in the expected order White,Black,Red. Simply opening the colourmap window & re-arranging the colours into the required order has fixed it for me, without using the mapping feature above.

from inky-phat.

Gadgetoid avatar Gadgetoid commented on September 13, 2024

How did you prepare your image? You have to pay close attention to the order of the colour palette when exporting- which is frustrating. Photoshop's new export functionality, for example, will totally mess it up, whereas the legacy "Save For Web" does not. D'oh!

I'll have to see if there's a way to fix the colour palettes in these images. I guess it should be simple enough to have a script that opens it, performs a palette swap based on parameters, and saves the result.

from inky-phat.

jose1711 avatar jose1711 commented on September 13, 2024

i tried to follow the instructions (use gimp + custom palette file). i guess i did something wrong. anyway in the end i solved it like this:

img = Image.open('img.png')
img2 = Image.new(mode='P', size=(212, 104))
remapped = []
pxmap = {0: 2, 1:0, 2:1}
for px in img.getdata():
    remapped.append(pxmap[px])
img2.putdata(remapped)
inkyphat.set_image(img2)
inkyphat.show()

i guess this can either be closed or flagged as enhancement. having a separate method implementing color indexes rotation would be nice i guess.

from inky-phat.

Gadgetoid avatar Gadgetoid commented on September 13, 2024

I'd tend to agree a method that supports colour index rotation would be nice. I'd maybe override set_image with an optional argument map or colswap or something.

from inky-phat.

marcosikkens avatar marcosikkens commented on September 13, 2024

I experienced this problem also, it was fixed by shackiey's comment. However it also needs to be updated in the documentation at: https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-phat.

There it also states the colour order in "White,Black,Red" en "Black,white, red" in the same page which only confused me.

from inky-phat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.