Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image aspect ratio morphed/incorrect #14

Closed
tobire opened this issue Feb 16, 2021 · 5 comments
Closed

Image aspect ratio morphed/incorrect #14

tobire opened this issue Feb 16, 2021 · 5 comments

Comments

@tobire
Copy link

tobire commented Feb 16, 2021

First of all: excellent software!

I created a simple python script to create images to display. Unfortunately, the image is somehow morphed:
IMG_20210216_220700

This is the displayed file:
db

I tried to load it directly from my python script aswell as directly from nginx and in both cases the image was morphed.

Would be nice if you have an idea on how to fix this :)

@pascalw
Copy link
Owner

pascalw commented Feb 16, 2021

Hi @tobire the Kindle only handles Grayscale PNGs correctly. Your PNG has an 8bit color/alpha profile. This is probably something you can specify in your Python code when generating the PNG. Alternatively you can convert the image using pngcrush: pngcrush -c 0 dash.png.

Let me know if that works!

@tobire
Copy link
Author

tobire commented Feb 17, 2021

It's kind of working now.
The image is not as stretched anymore but there are still not all 600x800 Pixels visible.
I added a border this time to make sure that I see it correctly:
IMG_20210217_065735
db

Are there any more requirements to the image in order for it to get displayed correctly?
Your example image is working fine btw.

@tobire
Copy link
Author

tobire commented Feb 17, 2021

Ah, nevermind, I made a mistake.
I used Pillow to convert the image to grayscale however the code found in a StackOverflow answer apparently did not work correctly.
After using pngcrush like you said, it's displayed correctly.
Thanks for the help! :)

@tobire
Copy link
Author

tobire commented Feb 17, 2021

In case anyone else wants to convert their image to grayscale in Python, this code works:

from PIL import Image, ImageOps
ImageOps.grayscale(Image.open('image.png')).save('grayscale.png')

@tobire tobire closed this as completed Feb 17, 2021
@pascalw
Copy link
Owner

pascalw commented Feb 17, 2021

Great! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants