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

Saving image with campixel shifted/clipped by 1 pixel #4793

Open
jebej opened this issue Feb 14, 2025 · 0 comments
Open

Saving image with campixel shifted/clipped by 1 pixel #4793

jebej opened this issue Feb 14, 2025 · 0 comments
Labels

Comments

@jebej
Copy link

jebej commented Feb 14, 2025

  • CairoMakie v0.13.1
  • fresh temporary environment
  • Windows 10

Using the code found here

using CairoMakie
x = rand(30, 40)
scene = Scene(camera=campixel!, size=size(x))
heatmap!(scene, x)
save("out.png", scene, px_per_unit=1)

This first issue is that now we must use px_per_unit=1 to get a png out with the same resolution as the image matrix, otherwise it is twice as big. The bigger issue however, is that one row and column of pixels is clipped, and replaced on the other side with what appears to be an interpolation with white. See this image (zoom in with paint.net or similar to preserve pixels without interpolation):

Image

This problem may in fact be related to the default px_per_unit=2, as in that case the image is clearly shifted by 1/2 "unit", aka one pixel:
Image

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

No branches or pull requests

1 participant