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

Spider file with last line black #2518

Closed
Marriaga opened this issue May 11, 2017 · 2 comments · Fixed by #5956
Closed

Spider file with last line black #2518

Marriaga opened this issue May 11, 2017 · 2 comments · Fixed by #5956
Labels
Bug Any unexpected behavior, until confirmed feature. NumPy
Projects

Comments

@Marriaga
Copy link

What did you do?

I ran the code below and then open the image in Fiji (ImageJ)

What did you expect to happen?

Create an image with a gradient that goes from 0 to 1 diagonally

What actually happened?

Created the image correctly but the last row of pixels is 0 (black). I don't know if this is a problem of Pillow in saving to spi or of imagej in opening spi.

What versions of Pillow and Python are you using?

4.1.1

from __future__ import division
from PIL import Image
import numpy as np

def gradient(i,j,S):
    return 1/2*(i+j)/(S-1)

# Create Image
S=512
Mpix=np.fromfunction(gradient,(S,S),dtype=np.float32,S=S)
Img=Image.fromarray(Mpix,mode="F")

# Save Image
Img.save("TestPIL_32.spi","spider")
@wiredfool
Copy link
Member

wiredfool commented May 13, 2017

I've taken a look at this, and I can confirm that it does show up in the Fiji interface with a black line. It's part of the image data, since it also shows up in the histogram.

I've also looked at the spider image in a hexeditor, and it's not there. So either Fiji is wrong, or there's an off by one somewhere in the image size such that it's reading one beyond the end of the image and filling that with 0s instead of actual data.

@aclark4life aclark4life added the Bug Any unexpected behavior, until confirmed feature. label Jun 21, 2017
@aclark4life aclark4life added NumPy and removed NumPy labels Jun 30, 2018
@aclark4life aclark4life added this to Backlog in Pillow May 11, 2019
@aclark4life aclark4life moved this from Backlog to Icebox in Pillow May 11, 2019
@radarhere
Copy link
Member

I've created PR #5956 to resolve this.

Pillow automation moved this from Icebox to Closed Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Any unexpected behavior, until confirmed feature. NumPy
Projects
Pillow
  
Closed
Development

Successfully merging a pull request may close this issue.

4 participants